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
Operation on String - C ++ Program: Write a program to define operations on string in c++. class String {    char *char_ptr;   // pointer to string contents    int le


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

Aim: To implement a program for dynamic data structure(linked list). Code:                       class node {             int data;             node *next;

One person who is specialist at programming and solving problems with a computer Project Description: Dear Potential computer, hardware, programming and software genius, I

if one won't explicitly call the destructor of a local; then how does he handle the above situation?

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw


write a c program to solve exanple of lamis therom