Commit 10997ef
committed
feat: Simulate School Management System using instance vs global (static) variables [school-static-instance-demo]
🎯 Purpose:
Demonstrates the use of both instance and static variables to model real-world objects in a school setup.
📌 Key Features:
- 👤 **Instance Variables**: Each `Student` has a unique `name` and `rollNumber`.
- 🌐 **Static Variables**:
- `schoolName`: Shared across all students.
- `totalStudents`: Tracks the number of student instances created globally.
- 🧾 **Static Method**: `displayTotalStudents()` shows the total number of students enrolled.
Signed-off-by: Somesh diwan <[email protected]>1 parent 8435461 commit 10997ef
File tree
1 file changed
+2
-1
lines changed- Section10Methods/LocalandGlobalVariables/src
1 file changed
+2
-1
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
0 commit comments