0% found this document useful (0 votes)
48 views5 pages

Assignment 3

The document is an assignment from the Software Engineering Department at Shaheed Zulfiqar Ali Bhutto Institute of Science & Technology, focusing on the concept of inheritance in object-oriented programming. It outlines tasks such as defining superclass and subclass, providing examples, describing benefits of inheritance, and identifying a hierarchy in a complex system. The assignment emphasizes the importance of understanding class relationships and their applications in programming.

Uploaded by

morganfinn65ley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views5 pages

Assignment 3

The document is an assignment from the Software Engineering Department at Shaheed Zulfiqar Ali Bhutto Institute of Science & Technology, focusing on the concept of inheritance in object-oriented programming. It outlines tasks such as defining superclass and subclass, providing examples, describing benefits of inheritance, and identifying a hierarchy in a complex system. The assignment emphasizes the importance of understanding class relationships and their applications in programming.

Uploaded by

morganfinn65ley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Shaheed Zulfiqar Ali Bhutto Institute of Science & Technology

SOFTWARE ENGINEERING DEPARTMENT


Total Marks: 04

Obtained Marks:

Software
Engineering
Assignment # 03
Last date of Submission: 22 April 2022

Submitted To: Syed Mahdi Abbas Shah

Student Name: Ibad Hassan

Reg. Number: 2380164


Shaheed Zulfiqar
Ali Bhutto Institute of Science
Technology
&
SOFTW
ARE ENGINEERINGAR
DEP
TMENT
: Copied or shown assignments will be marked
Instructions o. Latezer
submissions
e not
ar entertained
in any case.
Title:
Understanding inheritance in object-oriented programing.
Objectives:
The objective of this assignment is to introduce you the concept of the
inheritance in the object-oriented programing and help you understanding
how it used to define a “kind of” hierarchy among classes.
Tasks:
1. Define the term superclass and subclass in your own words to determine
your concepts.
2. Give an example of a superclass and a subclass relationship.
3. Describe the benefits of using inheritance in object oriented programing.
4. Identify and describe an example of a hierarchy within a complex
system.

Business Process BSSE SZABIST-


Engineering ISB
Title: Understanding Inheritance in Object-Oriented Programming
Objectives: This assignment aims to introduce the concept of
inheritance in object-oriented programming (OOP) and help you
understand how it is used to define a hierarchy among classes.
Tasks:
1. Define the terms superclass and subclass in your own words.
- Superclass: A superclass, also known as a parent class or base
class, is a class that serves as a template for other classes. It
contains common attributes and methods that are shared by its
subclasses.
- Subclass: A subclass, also known as a child class or derived class,
is a class that inherits attributes and methods from its
superclass. It can also have its own unique attributes and
methods.

2. Give an example of a superclass and a subclass relationship.


- Superclass (Parent Class): Shape
- Attributes/Methods: color, draw()
- Subclass (Child Class): Circle
- Additional Attributes/Methods: radius, area()

3. Describe the benefits of using inheritance in object-oriented


programming.
- Reusability: Code written in the superclass can be reused in
subclasses, reducing redundancy and promoting code reuse.
- Extensibility: Subclasses can add new attributes and methods to
the inherited ones, allowing for easy extension of functionality.
- Modularity: Classes can be organized into a hierarchy, making
the code more modular and easier to maintain. -
Polymorphism: Subclasses can be treated as instances of their
superclass, enabling objects to be used interchangeably based
on their common superclass.

4. Identify and describe an example of a hierarchy within a complex


system.
- Superclass: Animal
- Attributes/Methods: species, eat(), sleep()
- Subclass 1: Mammal
- Additional Attributes/Methods: fur_color, give_birth() -
Subclass 2: Bird

- Additional Attributes/Methods: wing_span, lay_eggs()


- Explanation: In this example, Animal is the superclass, and
Mammal and Bird are its subclasses. Mammal and Bird inherit
attributes and methods from Animal while adding their own
specific attributes and methods. This hierarchy reflects the
classification of animals in the natural world.

You might also like