I added the shape Rectangle to my code that was previously working correctly. Now I am receiving errors
||=== Build: Debug in Final Area (compiler: GNU GCC Compiler) ===|
main.cpp|6|error: expected nested-name-specifier before 'namespace'|
main.cpp|65|error: expected '}' at end of input|
main.cpp||In member function 'int Rectangle::main()':|
main.cpp|65|warning: no return statement in function returning non-void [-Wreturn-type]|
main.cpp|65|error: expected unqualified-id at end of input|
||=== Build failed: 3 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
When I remove Rectangle it works again. I have monkeyed around with it for hours. Need new eyes on it please.
I added the base class Shape. I am not sure about the inherence. Every change I make gives errors.
The other issue is the Rectangle is not calculating the area. However, the Circle and Square is calculating correctly.
The good news is there are no errors on the code as is but I am not sure about the inherence.
Add a new Shape base class to the area calculation program that includes data members common to all shapes (such as a shape ID, a shape type, and a unit of measure). The Shape base class should also include a virtual getArea() member function.
• Revise the Circle and Square classes so that they inherit from the Shape base class.
• Add a third shape to the program that also inherits from the Shape class. The finished program should ask the user to enter the relevant information for each shape and then print the area and other information for each shape.
In my opinion, Shape would be a bad name for the class as it is. The only function it has is getArea. I can't think of a better English name to describe something that has an area. But after more Shape type stuff is added it will probably be the best name.