top of page

example of class in oops c++ programming

#include <iostream.h>

class Rect



double length;

double breadth;

double calculateArea()


return length*breadth;



int main()


Rect obj;



cout<<"The Area of Rectangle is :"<<obj.calculateArea()<<endl;

return 0;


6 views0 comments

Recent Posts

See All

Object and Class in C++ Programming In this program, we have used the Room class and its object room1 to calculate the area and volume

bottom of page