#include <iostream.h>
#include<conio.h>
struct MyClass
{
int getl() { return i; } // these are public by default
void setl(int j) { i = j; }
private:
int i;
};
void main()
{
MyClass s;
s.setl(10);
cout <<s.getl();
getch();
}
Output:
10
By Dinesh Thakur
#include <iostream.h>
#include<conio.h>
struct MyClass
{
int getl() { return i; } // these are public by default
void setl(int j) { i = j; }
private:
int i;
};
void main()
{
MyClass s;
s.setl(10);
cout <<s.getl();
getch();
}
Output:
10
Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.
For any type of query or something that you think is missing, please feel free to Contact us.