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
#C Why don''t online compilers support the header file? What can I do to resolve this? PS. I have tried , does''nt work either. Thannk in advance.


I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

solve for radius(R) of a circle of its area is to be inputted by a user. also display compute the circle diameter hint: area= pir21 pi=2.1416

HOW TO USE POINTER

demonstrates shearing about origin

c program of double linked list with full explanation

how do i print out invalid input?

color representation 0,1,2,3,4,5,6,7...