0% found this document useful (0 votes)
4 views

Lab 11

The document outlines 3 tasks involving object-oriented programming concepts: 1. Create Chicken, Fish, and Duck classes with member functions, then create a FisDucKen class that inherits from these. Call member functions from the parent classes and observe if there are any conflicts. 2. Create AudioPlayer and VideoPlayer classes that inherit into a MultimediaPlayer class. The parent classes have play functions and the child calls these. 3. Design a Computer class using composition and aggregation with CPU, RAM, and Storage component classes.

Uploaded by

bsmt22098
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lab 11

The document outlines 3 tasks involving object-oriented programming concepts: 1. Create Chicken, Fish, and Duck classes with member functions, then create a FisDucKen class that inherits from these. Call member functions from the parent classes and observe if there are any conflicts. 2. Create AudioPlayer and VideoPlayer classes that inherit into a MultimediaPlayer class. The parent classes have play functions and the child calls these. 3. Design a Computer class using composition and aggregation with CPU, RAM, and Storage component classes.

Uploaded by

bsmt22098
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Task 1:

Make a Chicken class that has sing, eat, move as member functions.

∙ During sing, print message “Hii, I’m snging”

∙ During eat, Print "Eat Sing Repeat"

∙ During move, Print a message “Hii, I’m just walking”

Make a Fish class that has eat, move as member functions.

∙ During eat, Print a message “let’s have some Flake Food”

∙ During move, Print a message “Hii, I’m Enjoying swimming in this water”

Make a Duck class that has Speak, run as member functions.

∙ During Speak, Print “Quack Quack”

∙ During RUN, Print “duck is running”

Now Make a FisDucKen class as child class that inherent all three classes created earlier. Create a object
for this class and called different member functions from parent class.

● Did you observe any conflicting function while calling member functions?
● If so, then according to you what could be the solution to resolve this issue.

Task 2:
Design a multimedia player class that can play both audio and video. Create separate
classes for audio Player and video Player and then inherit them into a class for a
multimedia player. the parent and child classes have the following functions

Play audio: print “audio is playing”

Play Video: print ”playing video”


play function in child class: to call play audio and play video functions

Task 3:
Design a computer class that has various components like CPU, RAM, and Storage. Use
the following methods to assemble a computer with different components.CPU, RAM,
and Storage are classes representing components of a computer.
● Using composition
● Using aggregation

You might also like