C++ language

A Program Of Class With Two Objects
Previous Home Next
#<iostream.h>
class reactangle
{
int a, b; // private by default
public :
void set_values(int,int);
int area()
{		
return(a*b);
}
};
void rectangle::set_values(int a,int b)
{
x=a;
y=b;
}
int main()
{
rectangle rect,rectb;
rect.set_values(3,4);
rect.set_value(5,7)
cout<<"rect area"<<rect.area();
cout<<"rectb area"<<rectb.area();
return0;
}
Output: rect area 12 rectb area 35
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: