In an example with no overrides and nothing, just simple inheritance with the same method name, it should give an error but it doesn't or I'm wrong in my interpretation.
What I want is this but I want it to give me an error that the same method cannot be used.
Car.java:
public abstract class Coche
{
public abstract int sampleMethod(int y);
}
Limousine.java:
public class Limusina extends Coche
{
public Limusina()
{
}
public int sampleMethod(int y)
{
return y;
}
}
In theory, your class diagram shouldn't give any errors... Although in the graph you inverted the order of the methods and attributes of the class, the inheritance is well thought out.
What you have are two classes: an abstract one (FigureGeometrica) and a concrete one (Circle). Being an inheritance relationship, the Circle class must implement ALL the ABSTRACT METHODS of the superclass (GeometricShape), in this case draw().
Would you have something like this...
This allows you to apply the techniques of polymorphism (to create other geometric figures, such as the Square, Triangle class) and dynamic binding (to be able to change the shape of the geometric figure you want to use at runtime).