§1 The four pillars
| Pillar | Meaning | In code |
|---|---|---|
| Encapsulation | Hide internal state behind methods | private fields, public getters/setters |
| Abstraction | Expose what an object does, not how | abstract classes, interfaces |
| Inheritance | Reuse and extend a base type ('is-a') | class Dog extends Animal |
| Polymorphism | One interface, many implementations | overriding; overloading |
§2 Terms that are often confused
§3 Worked examples
Example 1
Shape s = new Circle(2); s.area(); — which area() runs if Circle overrides it?
- The variable's type is Shape, but the object is a Circle.
- Overridden methods dispatch on the runtime type.
Answer Circle's area()
! Common traps
- Thinking a private field is inherited as accessible — subclasses cannot access it directly.
Coverage source: 2023 ICT Proficiency Certification Examination FAQs (file dated 14 Feb 2023) (third-party copy)