+ 1

Calculate Area with Inheritance and Virtual Function

Here is the zip file of my code: https://www.dropbox.com/s/rfw7a2wkqdjbc3d/newAreaProgram.zip?dl=0 I keep getting an error: ||=== Build: Debug in calculateArea (compiler: GNU GCC Compiler) ===| \calculateArea\circle.cpp|24| error: expected unqualified-id before ')' token| \calculateArea\circle.cpp|28| error: expected ')' before 'id'| \calculateArea\circle.cpp|33| error: expected ')' before 'id'| ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 7 second(s)) ===| Can someone help me solve these errors and tell me why they are happening? I also need to create another class for another shape and have it inherit the Shape class attributes. I feel like this is something simple but I have been looking at it for four hours, I am sure I am just frustrated. I want the circle and the square class to be derived classes of the Shape base class. I have a virtual function getArea which I set to 0 so it can be defined in its own classes. The errors I encountered above are what it stopping me.

10th Dec 2017, 11:07 PM
Elyse Segebart
Elyse Segebart - avatar
1 ответ
0
I have corrected your code, and have added comments under each line that gave an error, and how I corrected it. Hope that helps. https://drive.google.com/open?id=1RaV-IfhbYzTFKp9BS9lOgTis--yZMHef
15th Dec 2017, 3:26 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar