0
What is the error in the following declaration of a constructor for the class Rectangle?
3 Réponses
+ 6
Your code is looking incomplete first read basic concepts like how to make class how to call functions......etc after that u can make easily.
This is your program.
#include <iostream>
using namespace std;
class Rectangle
{ public:
int area;
void Area(int length, int breadth)
{
area =length*breadth ;
cout<<"Area of Rectangle is "<<area;
}
};
int main()
{
Rectangle area;
area.Area(5,4);
}
+ 1
There is no class. No member declaration.
Revisit this part of the course.
https://www.sololearn.com/learn/CPlusPlus/1711/
0
Avinesh thanks a lot ^^