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
Aim: To implement a program to create, update & display account & admin record of person using display account & admin records of person using virtual base class.. Code:

Described the difference among "new" and "operator new" ? A:"operator new" works such as malloc.

Spider webs have two types of silk, sticky silk and strength silk, spiders do not move on the sticky silken threads only on the strength threads. Assume one type of spider creates

Described the differences among a C++ struct & C++ class? A: The default member & base class access specifies are distinct. It is one of the commonly misunderstood aspects of C+

Define the Volatile Keyword Qualifiers in C Language? The volatile keyword proceed as a data type qualifier and a volatile variable is for dynamic use. E.G. for data that is to

Bitwise Operations 1. Write a function that has an int parameter n, makes an integer mask having the bit 1 at the nth place from the rightmost bit, and returns the mask. For ex

In this sub-task will you implement three functions for the final three function prototypes that will do exactly the same as the three functions that you have just written. This ti

C Program for RADIUS OF CIRCLE   #define PI 3.14159 main() {           float r,a;           clrscr();           printf("ENTER THE RADIUS OF A CIRCLE: ");

program for compiler design in c

A: A using declaration makes it possible to employ a name from a namespace without the scope operator.