Create simple class
Make simple Class ...
#include<iostream.h>
#include<conio.h>
Class test
{
int a,b; //member variable of class. .
public: //public section of class
void getdata()
{
cout<<"enter value of A and B : ";
cin>>a>>b;
}
void showdata()
{
cout<<"A = "<<a;
cout<<"B = "<<b;
}
};
Void main()
{
test t1; //t1 object of class test...
Clrscr();
t1.getdata(); //call mathod of class using object of that class.....
t1.showdata();
Getch();
}
A : 10 B : 20
To know about God and Godly University please click here : www.pbks.info
other programs.....
1.simple cpp program
2.simple class
3.add two numbers of class
show this all programs

0 comments: