UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the meaning of :: ,->, : in C++?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

Professor

:: is scope resolution operator It is basically used to define non inline functions i.e when u want to write body of function outside the class -> Opera is used with pointers This is used to access the members of a class (object)or structure whose address is stored in some pointer say( p) Suppose...
read more

:: is scope resolution operator

It is basically used to define non inline functions i.e when u want to write body of function outside the class

-> Opera is used with pointers

This is used to access the members of a class (object)or structure whose address is stored in some pointer say( p)

Suppose student is a class wih members roll, and name

 

Student s;

s is a object

Student *p;

p=&s

now p holds address of object s and s has 2 members roll and name 

I can access members of s directly using . Operator 

cout<<s.roll

cout<<s.name

 

In second scenario we can access members of s through a pointer p as follow

Cout<<(*P).roll

cout<<(*p).name

instead of using (*p). We can use --> operator as follow

cout<<p->roll

cout<<p->name

 

read less
Comments

Related Questions

Difference between "C structure" and "C++ structure".
C is process oriented programming.. so c follows procedure in execution where as C++ is object oriented and messages are been passes between the objects..
Khushboo
How can I avoid the error messages?
When there is a syntax error in the program the compiler indicates it by giving error messages. By following proper syntax we can avoid error messages. Syntax is like grammar rules of english language.
Yusufali
How do I get 6 power 13 in c language?
#include <stdio.h> #include <math.h> int main() { double result = pow(6, 13); printf("6 to the power of 13 is: %f ", result); return 0; }
Raju
0 0
6
Why is the C program giving the wrong output?
Hi Chandra, Please remember that the program will not give wrong output. The output might be wrong only in the case where there has been incorrect logic used or different output is expected. What is the...
Chandra
0 0
5
What purpose does \n have in C programming?
is used for new line. It prints the output in New or next line
Nasar
0 0
9

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Some Tricky Questions in C
Can you write two functions in which one executes before main function and other executes after the main function? #pragma startup #pragma exit Where, priority is optional integer value.For user priority...

Static and dynamic libraries
A library is a package of code that is meant to be reused by many programs. A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When...

Necessity of Theory and Practical in Computer Science.
Upon studying a subject both theory and practical are important. Usually many schools concentrate more on theory and the marks not on the practical. Other and opposite kind of people prefer practical...

Memory Layout of C Programs
A typical memory representation of C program consists of following sections. Text Segment: A text segment, also known as a code segment or simply as text, is one of the sections of a program in an object...

C and C++ programming with memory level debugging
Understanding C and C++ programming by using memory level debugging. Step 1: Understand the Memory map of C executable Step 2: Start memory level debugging using popular IDE Step 3: Find the memory...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more