private member functionsa private member


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 ( );

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: private member functionsa private member
Reference No:- TGS0161134

Expected delivery within 24 Hours