Tuesday, 24 February 2015

This Pointer Using C++

/* This Pointer */

#include<iostream.h>
#include<conio.h>

class Rectangle
{
private:
int width,height;
public:
void Create(int width,int height)
{
this->width=width;
this->height=height;
}
void Display()
{
cout<<"\n Width :"<<width;
cout<<"\n Height :"<<height;
}
};

void main()
{
clrscr();
Rectangle r1,r2;
r1.Create(100,100);
r1.Display();
r2.Create(200,200);
r2.Display();
getch();
}

No comments:

Post a Comment