Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Intermediate
Mar 5, 2001

Arrays of Pointers to Members


You can create an array of pointers to member just as you would create arrays of any other type. The following example creates an array of pointers to member functions of class Parrot and initializes its elements with the addresses of Parrot's member functions:
 
class Parrot
{
public:
 void Speak() const;
 void Fly() const;
};

typedef void (Parrot::*PMF)() const;
// create array
PMF funcs[2]={&Parrot::Speak, &Parrot::Fly};
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap