c++ oop class example i

Post on 22-Jan-2017

18 Views

Category:

Engineering

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

#include <iostream>

using namespace std;

// classes example

class test{

int hei,wid;

public :

void v(int x, int y) //constructor

{

hei=x;

wid=y;

};

int area();

};

int test :: area()

{

return hei*wid;

}

int main()

{

test ss;//ss is object

int a,b;

cin>>a>>b;

ss.v(a,b);

cout<<ss.area()<<endl;

}

Samsil Arefin

Samsilarefin016@gmail.com

top related