Showing posts with label access private member function in CPP. Show all posts
Showing posts with label access private member function in CPP. Show all posts

20120124

How to acces private member function in C++/CPP

How to acces private member function in C++/CPP
Program to show accessibility of private member function.
//private member function(skeleton) can be accessed using
//member function only and not by object and dot operator
#include<iostream>
using namespace std;
class item
{
private:
        int number;
        float price;
        void getdata(int a, float b) // here member function getdata
                                               //is private so not accessible by object