Init guide environment...
How the four pillars shape a typical OOP class structure
classDiagram
class Animal {
+String name
+int age
+breathe() void
+speak() String
}
class Dog {
+String breed
+bark() void
+speak() String
}
class Cat {
+bool isIndoor
+purr() void
+speak() String
}
class BankAccount {
-float balance
-String owner
+getBalance() float
+deposit(amount) void
+withdraw(amount) void
}
class Shape {
<<abstract>>
+area() float
}
class Circle {
+float radius
+area() float
}
class Rectangle {
+float width
+float height
+area() float
}
Animal <|-- Dog : Inheritance
Animal <|-- Cat : Inheritance
Shape <|-- Circle : Abstraction
Shape <|-- Rectangle : Abstraction
style Animal fill:#1a1f2b,stroke:#7c4dff,color:#fff
style Dog fill:#12161f,stroke:#ff4081,color:#fff
style Cat fill:#12161f,stroke:#1de9b6,color:#fff
style BankAccount fill:#1a1f2b,stroke:#7c4dff,color:#fff
style Shape fill:#0d1117,stroke:#00e5ff,color:#aaa
style Circle fill:#12161f,stroke:#00e5ff,color:#fff
style Rectangle fill:#12161f,stroke:#ff4081,color:#fffSelect a pillar to watch the class diagram animate step-by-step
Understand the trade-offs and strengths of each OOP principle
| Pillar | Safety | Reusability | Complexity | Flexibility |
|---|---|---|---|---|
| 🔒 Encapsulation | ||||
| 🎭 Abstraction | ||||
| 🧬 Inheritance | ||||
| 🔄 Polymorphism |