What are pointer-to-members in C++? Give their syntax.



What are pointer-to-members in C++? Give their syntax...

Answer / Iqbal Ahmed

Pointer-to-members, also known as member pointers, are used to access members of a class indirectly. They have the form &Class::member and can be accessed with -> operator, like ptr->memberName. The syntax for defining a pointer-to-member is: Class* const CLASS::*ptr_to_member;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Why the usage of pointers in C++ is not recommended ?

1 Answers   TCS,


How did c++ get its name?

1 Answers  


What is the limitation of cin while taking input for character array?

1 Answers  


What are the different types of polymorphism in c++?

1 Answers  


Is atoi safe?

1 Answers  


What language is a dll written in?

1 Answers  


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


Is vector a class in c++?

1 Answers  


Why do C++ compilers need name mangling?

3 Answers   Lucent,


What are the 4 types of library?

1 Answers  


What are friend functions in C++?

1 Answers   BlackRock,


How can I disable the "echo" feature?

1 Answers  


Categories