Private member functions, C/C++ Programming

Private Member Functions:

A private member functions can be called by the members of the same class.  Consider the following example.

 

class sample

{ int number;

float cost;

void read(void);

public:

void update(void);

void display(void);

};

 

sample p; Constructing a object of class sample.

p.read( ); This is a invalid statement the private member cannot be accessed outside the class.  However this is a valid statement because the read is in the same class sample.

void sample : : update(void)

{read ( );

}

Posted Date: 9/20/2012 7:53:40 AM | Location : United States







Related Discussions:- Private member functions, Assignment Help, Ask Question on Private member functions, Get Answer, Expert's Help, Private member functions Discussions

Write discussion on Private member functions
Your posts are moderated
Related Questions
construct a console programme for a bank ATM machine.


Q: How can one encourage his (older) compiler to check new to see automatically if it returns NULL?       A: His compiler eventually will. If he contain an old compiler wh

A: A reference has to always refer to some object and, so, must always be initialized; pointers do not have such limits. A pointer may be reassigned to point to distinct objects wh

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed

one of the segments is showing compilation error...


Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec