Questions about my program and Polymorphism
- by Strobe_
Ok, so basically I'm creating a program which allows the user to select a shape (triangle, square, circle) and then it takes in a int and calculates the boundary length and area.
I have no problem doing this and have a program that's working perfectly. (https://gist.github.com/anonymous/c63a03c129560a7b7434 4 classes) But now I have to implement this with polymorphism concepts and I'm honestly struggling as to how to do it.
I have a basic idea of what I want to do when it comes to inheritance
Main
|
Shapes
/ | \
triangle circle square
But I don't understand how I'm supposed to override when all the methods within the triangle/square/circle classes are unique, there are no "abstract" methods as such that I could inherit from the "Shapes" class.
If somebody could make look quickly at the code I linked and suggest a way to do this it would be much appreciated.
Sorry if I was bad at explaining this. Thanks.