Illustrates invoking class members (data and function) via instance (objects) in C++

Program :-

#include<iostream.h>
class ABC
{
public: int i;
void display()
{

cout<<"Invoking member function through object";

}
};
void main()
{
ABC obj;
obj.i=4;
cout<<obj.i;
obj.display();
}

Output :-

4 Invking member functon through object

Comments

Popular posts from this blog

How to make a snake game using notepad using html [ with pictures ]

Program to find Addition of "n" numbers useing for loop

how to speed up your internet using cmd [command prompt] with pictures [100% working]