You are on page 1of 4

OBJECT ORIENTED PROGRAMMING

Lab # 07 OOP

MUHAMMAD SAIM ASHRAF

Names

FA21-BEE-128
Registration
Numbers

Class 3A (BEE)

Instructor’s Name DR RIAZ HUSSAIN

Lab Assessment
Post Lab Total
Pre-Lab In-Lab
Data Presentation Data Analysis Writing Style
Lab 07 – Inheritance and Overriding

Task 4.1 Example


In this task we are just learning about how to specify
the derived class
We used this method to join derived class with parent
class
class DerivedClass : public BaseClass
LINK:
https://onlinegdb.com/9qV2RsvS7u

Task 4.2 Example


. This example will explain the way to access the base
class members with derived class object.
LINK:
https://onlinegdb.com/vFisNM6Kj

Task 4.3 Example


This example demonstrates that how we can use the
concept of Overriding.
LINK:
https://onlinegdb.com/UPyNlzGwWM

Task 5.1
In this in lab task we have to Create a class publication
and we also have to make two derive classes for book
and audio cassette.
LINK:
https://onlinegdb.com/GjfbFg-qt

Task 5.2
In this I have to make a class Person that has attributes
of id, name and address. It has a constructor to
initialize, a member function to input and a member
function to display data members. And also I have to
make a student class which inherits this person class
LINK:
https://onlinegdb.com/mu_IGUPb_W

Task 5.3
In this I have to make a base class Computer that
contains data members of wordsize. In this Member
functions for both classes include a default constructor,
a constructor to inialize all components and a function
to display data members.
LINK:
https://onlinegdb.com/vibj3ff1v

Task 6.1
In this we have to make a program having a base class
Student and a class Test is derived from class Student
We have to make a function Finalresult() to calculate
value for final variable using other marks.
LINK:
https://onlinegdb.com/wBc42RaMHT

Task 6.2
In this we have to make a program that declares two
classes. The parent class is called Simple that has two
data members num1 and num2 to store two numbers.
It also has four member functions of add,sub,mul and
div. we have to override this with a new derive class
LINK:
https://onlinegdb.com/uwEGEuo2Bx

Task 6.3
In this we have to Define a class Electricity in which the
function Bill computes the cost and a derived class
More_Electricity and override Bill to add the surcharge.
LINK:
https://onlinegdb.com/AkA3ii96B

Task 6.4
In this program we have to do a bunch of thing but
mainly we have to just take input from user and Write a
test program that creates objects of each type of
Package and tests member function calculateCost() to
calculate cost of pakage.
LINK:
https://onlinegdb.com/sF8a0hXiK

You might also like