notesonly.in

One notebook for every subject — open it anywhere.

Log in

Interfaces and abstract classes

Object-Oriented Programming · Engineering

Study notes

Define Drawable interface with draw(); Circle and Square implement it differently. A render(Drawable d) function works with any shape. An abstract Shape class provides color field plus abstract area(); Circle extends Shape, implements area(). Interfaces enable multiple inheritance of type; abstract classes share code.

← Back to topics for Engineering