I recently learnt about inheritance and noticed that if all the subclasses inherited the public/protected methods from its superclasses, does that mean we have multiple copies of the same method? Isn't that a waste of space?
Eg:
class Shape
{
//some code
public void rotateShape()
{...}
//some code
}
class Triangle extends Shape
{
}
class Square extends Shape
{
}
So does this mean I have 3 copies of the method rotateShape() belonging to the 2 subclasses and 1 superclass assuming I instantiate an object from each class?