C++ Concept Map

Function members

An object may contain functions which are stored internally and are unique to that object. Each such function needs an appropriate declaration, as a prototype, in the class.

Function members can be ordinary functions, but they can be overloaded, have default parameter values, or be virtual.

Special function members are constructors and the destructor. In the example below, there are two (overloaded) functions called f1, one private and one public; two constructors, one private and one public, and one destructor;

class C {
private:
   void f1(int);
      C();
public:
   void f1(int, int);
      C(int);
      ~C();
};

Function members can be called using the same member access operator as data members.


Please mail any corrections and/or suggestions to Roger Hartley at
rth@cs.nmsu.edu

Copyright © 2003 Roger Hartley