source code: OOP1.cpp
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
class simple
{
int a,b;
public:
void get(int m, int n)
{
a=m;
b=n;
}
void show()
{
cout<<" a: "<<a<<" b: "<<b;
}
} ;
void main()
{
clrscr();
cout<<"object oriented program: ";
simple ob1, ob2;
ob1.get(10,20);
ob2.get(-5, -15);
ob1.show();
ob2.show();
getch();
}
output:
object oriented program:
a : 10 b:20
a: -5 b: -15
0 Comments
Post a Comment