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

Object Oriented Programming Lab 11 Topic Covered: Inheritance FIFO (First in First Out)

The document describes an object-oriented programming lab assignment on inheritance and FIFO data structures. Students are asked to create two classes - a base fifo class with push and pop functions, and a derived fifo2 class that adds checks for full and empty conditions when pushing or popping. The main function tests the fifo2 object by pushing and popping elements in a specific order and displaying the results.

Uploaded by

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

Object Oriented Programming Lab 11 Topic Covered: Inheritance FIFO (First in First Out)

The document describes an object-oriented programming lab assignment on inheritance and FIFO data structures. Students are asked to create two classes - a base fifo class with push and pop functions, and a derived fifo2 class that adds checks for full and empty conditions when pushing or popping. The main function tests the fifo2 object by pushing and popping elements in a specific order and displaying the results.

Uploaded by

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

Object Oriented Programming

Lab 11
Topic Covered: Inheritance FIFO (First In First Out)

Q1A. Create a class named fifo.


1. It has three attributes as protected
 st as int array of size MAX=5.
 top as int
 tail as int
2. Make no argument constructor to set top and tail
equals to -1.
3. Make void push(int var) function to insert data into
top of the fifo and write cout<<“Push = ”<<var<<endl.
4. Make int pop() function to remove data from the tail
of the fifo.
Q1B. Create another class named fifo2 that is publicly
inherited from fifo class.
1. Make void push(int var) function to insert data into
fifo and check the full condition before inserting.
 If the fifo is full then display the “Fifo Full”
message otherwise call void push(int var) function
of parent class from child class.
2. Make int pop() function to remove value from the fifo
and check the empty condition before removing.
 If the fifo is empty then display the “Fifo
Empty” message and return -1 otherwise call int
pop() function of parent class from child class.
 Also set the top and tail to -1 when both become
equal
Q1C. Make main() function
Make a fifo2 object. Call the functions in following order
 push, push, push, push, push, push, pop, pop,
pop, pop, pop, pop, push, push, pop, pop and show
information on screen.

You might also like