Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Subject : Object Oriented programming program : C Language O Q3. Topic: Inheritance CL0-3 10 Marks Create a Class Named Stack that has an integer
Subject : Object Oriented programming program : C Language
O Q3. Topic: Inheritance CL0-3 10 Marks Create a Class Named Stack that has an integer array of size 5 and a variable top for location of data on stack. Make a function named push to place data in stack. Make a function named pop to get data from stack. Create another Class named Stack2 that is inherited from class Stack. Make push and pop functions in this class Stack2. Now push function before pushing the data on stack first checks if the stack is full. If the stack is not full then it calls the push function of its parent class. Now pop function before popping out the data from stack first checks if the stack is empty. If the stack is not empty, then it calls the pop function of its parent class. Make an object of Stack2 class and test the push and pop functions in main() function. O OStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started