Notes by
Ben Borgers
F’22
Rectangle r1
creates a pointer to a variable of class Rectangle, but Rectangle r1 = new Rectangle()
creates the real thing.abstract class
can’t be instantiated, it can only be inherited from.Shape
can hold Rectangle
or Circle
at runtime (and this is how you do inheritance).
Shape s1;
s1 = new Circle();
protected
allows sub-classes to access a variable (method), while private
does not.abstract public void functionName()
in the parent class givves a heads-up that subclasses provide that function.