-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (35 loc) · 1.05 KB
/
main.py
File metadata and controls
41 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
from basics.encapsulation import EncapsulationExample
from basics.inheritance import InheritanceExample
from basics.polymorphism import PolymorphismExample
from basics.abstraction import AbstractionExample
def show_menu():
print("\nPython OOP Showcase")
print("1. Encapsulation")
print("2. Inheritance")
print("3. Polymorphism")
print("4. Abstraction")
print("5. Exit")
def main():
while True:
show_menu()
choice = input("Choose an option (1-5): ")
if choice == "1":
obj = EncapsulationExample()
obj.demo()
elif choice == "2":
obj = InheritanceExample()
obj.demo()
elif choice == "3":
obj = PolymorphismExample()
obj.demo()
elif choice == "4":
obj = AbstractionExample()
obj.demo()
elif choice == "5":
print("Exiting...\n")
sys.exit()
else:
print("Invalid choice! Please select again.")
if __name__ == "__main__":
main()