Login | Register   
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
Jul 23, 1999

Overloading the Function Call Operator

Overloading the function call operator can be somewhat confusing because the overloaded operator has two pairs of parentheses. It may not be immediately obvious which of these pairs declares the parameters. Another point to note is that the overloaded function call operator may take any number of arguments whereas all other overloaded operators take a fixed number of arguments. This example shows how you can overload the () operator and use it:

 
class A
{ 
private: 
  int n;
public: 
 //
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap