OOOSE Assignment 1
OOOSE Assignment 1
ASSIGNMENT 1
OBJECT ORIENTED SOFTWARE ENGINEERING
SUBMITTED BY:
PRASHANT BHANDARI
ROLL NUMBER: 41 (B)
SUBMITTED TO:
PROF. DR. SUBARNA SHAKYA
CENTRAL DEPARTMENT OF COMPUTER SCIENCE &
INFORMATION TECHNOLOGY
March, 2025
Question
Write a program in any object-oriented programming language to include all the
features listed below.
• OBJECTS
• CLASSES
• INSTANCES
• INHERITANCE
• POLYMORPHISM
• Information hiding
Code in Python:
1 # CLASSES AND OBJECTS
2 # Define a class for Student
3 class Student :
4 # Constructor to initialize student details ( Encapsulation -
Information Hiding )
5 def __init__ ( self , name , roll_number , section ) :
6 self . name = name # Public attribute
7 self . roll_number = roll_number # Public attribute
8 self . section = section # Public attribute
9
10 # Method to display student details
11 def display_details ( self ) :
12 print ( f " { self . name } , Roll Number : { self . roll_number } ,
Section : { self . section } " )
13
14 # INHERITANCE
15 # Define a subclass for MSC CSIT Student ( inherits from Student )
16 class MSC_CSIT_Student ( Student ) :
17 def __init__ ( self , name , roll_number , section ) :
18 # Call the parent class constructor to initialize common
attributes
19 super () . __init__ ( name , roll_number , section )
20
21 # POLYMORPHISM
22 # Override the display_details method
23 def display_details ( self ) :
24 # Call the parent class method to display student details
25 super () . display_details ()
26