Saturday, June 12, 2010

outside definition and insdie definition of function in c++ class

#include
//Author:- Subhasis Nayak(G-TECH,BBA,MCA)
//PROGRAM:- OUTSIDE AND INSIDE MEMBER FUNCTION
class outinClass{
    int x,y;
    public:
    void getValue(){
    x = 100;
    y = 200;
    }
    //Function body is on ouside This is just the prototype
    void disValue();
};


//  Function "void disValue();" body is here
void outinClass::disValue(){
    cout<<"\nThe value of x is: "<
    cout<<"\nThe value of y is: "<
}
int main(){
//creating object of the class
outinClass ob;
// calling the member functions
ob.getValue();
ob.disValue();
return 0;
}

No comments:

Post a Comment