Networking, Programming and Graphics Tutorials

Pointers to members - C++ [1/1]

Type:
Pointers to members - C++
Level: Expert Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
Pointers to members - C++
Date: 2006-Dec-08
Pointers to members - C++
Visited: 888 times
Pointers to members - C++
Rating: Pointers to members - C++
Pointers to members - C++
Author: Alex Plumpton

C ++ allows you to generate a special type of pointer that points to a member of a class, not to a specific instance of that member in an object. This sort of pointer is called a pointer to a class member or pointer-to-member. The figure shown, illustrates the usage of pointer to members.

Pointers to members - C++
Pointers To Members
int stud :: *info =&stud::id;

The info pointer, thus created, acts like a class member in that it must be invoked with a class object. In the statement, the phrase stud::' means "pointer- to —member ofstutl class". The phrase &stud:: id means the "address ofthe id member of stud class". The pointer info can now be used to access the memberid inside member functions.

Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Pointers to members - C++ [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: pointer-to-members c++  What are pointer-to-members in C++?  C++ pointer-to-members  data members in c++  c static data members  excluding members from copy constructor  pointers to objects  pointers to objects-c++  c++-pointers to objects  c++ pointers to objects  c++ pointers objects  end of file pointers C++  file pointers-c++  functions and pointers c++ * &  c++ "file pointers" example   manipulation of pointers in C++  c pointers tutorial  pointers to objects C++  manipulation of pointers c++  c++ "pointers to objects" tutorial