Search
example of class in oops c++ programming
#include <iostream.h>
class Rect
{
public:
double length;
double breadth;
double calculateArea()
{
return length*breadth;
}
};
int main()
{
Rect obj;
obj.length=10.5;
obj.breadth=20.5;
cout<<"The Area of Rectangle is :"<<obj.calculateArea()<<endl;
return 0;
}
Recent Posts
See AllObject and Class in C++ Programming In this program, we have used the Room class and its object room1 to calculate the area and volume
Comments