Skip to content

Commit 10997ef

Browse files
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

1 file changed

+2
-1
lines changed

Section10Methods/LocalandGlobalVariables/src/Combined Application of Both (Hard Example).txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ Global Variables: schoolName is shared by all students, and totalStudents keeps
99
Static Method (displayTotalStudents()) prints the total students enrolled.
1010

1111
## Conclusion
12+
1213
| Type | Application Example |
1314
|---------------------------|---------------------------------------------------------------------------------------|
1415
| Instance Variables | Storing unique data like Student Names, Account Balances, Game Player Stats |
1516
| Global (Static) Variables | Shared values like Company Name, Interest Rates, Logging Levels, Total User Count |
16-
| Both Combined | Tracking Enrollments in Schools, Shared Game Scores, Singleton Database Connections |
17+
| Both Combined | Tracking Enrollments in Schools, Shared Game Scores, Singleton Database Connections |

0 commit comments

Comments
 (0)