expected initializer before ...

I'm just trying to create a basic inheritance and I get the initializer error at the TriangleObject line.


#include "Shape.h"
#include "Rectangle.h"
#include "Triangle.h"
#include "Square.h"
#include <iostream>

using namespace std;


int main(){


Rectangle rectangleObject(2,5);
Triangle triangle1Object(1,10);
Square squareObject(5);

cout << "The area of the rectangle is" << rectangleObject.get_area() << '\n';
cout << "The perimeter of the rectangle is " << rectangleObject.get_perimeter() << '\n';
cout << "The area of the triangle is " << triangleObject.get_area() << '\n';
cout << "The area of the square is " << squareObject.get_area() << '\n';

return 0;
}
Please copy and paste the exact error message.

triangle1Object is not the same as triangleObject

Please edit your post make sure your code is [code]between code tags[/code] so that it has line numbers, as well as syntax highlighting and proper indentation.
Last edited on
Topic archived. No new replies allowed.