OOPS - Lab File
OOPS - Lab File
● Use a yellow-colored lab file and write your answers on plain white sheets.
● Write only the question number and a brief one-line version of the question. Do not
copy the full instructions into the lab file.
Submit your completed lab file in the Computer Lab and sign the Lab File Submission
Record Sheet.
● If any question seems unclear or you are unsure of what exactly needs to be done, you
may make a reasonable assumption. Clearly mention your assumption in the
answer.
● Due Date: 31-05-2025
Q1. Write a program to demonstrate the concept of class, objects, data members,
member functions, and access specifiers in C++.
Instructions:
● In main():
Instructions:
○ Constructors:
■ Parameterized constructor
■ Copy constructor
● In main():
3. Constructor Overloading
Instructions:
○ Constructors:
■ Two-arg constructor
● In main():
Q4. Write a program to overload the '+' operator for a Complex class using a member
function.
Instructions:
● In main():
Q5. Write a program to overload the ‘>>’ and ‘<<’ operators for input and output using
friend functions.
Instructions:
● Create class Time with:
● In main():
Instructions:
● In main():
Q7. Write a program to demonstrate virtual base class and abstract class.
Instructions:
● Create abstract class Shape with pure virtual function area()
● In main():
8. Function Overloading
Q8. Write a program to demonstrate function overloading using different data types and
number of parameters.
Instructions:
○ Two integers
○ Two floats
○ Three integers
● In main():
Q9. Write a program to demonstrate class and function templates with one and multiple
type arguments.
Instructions:
● In main():
○ Use the class and function with different types (int, float, string)
Q10. Write a program to demonstrate pointers to object, pointer to class, void pointer,
and array usage.
Instructions:
● Use a void pointer to store address of int and float, and print their values using
typecasting
Q11. Write a program to demonstrate try, throw, catch with different exception handling
techniques.
Instructions:
○ Terminate
● Use multiple catch blocks for int, string, custom exception class
Q12. Write a program to demonstrate built-in to class type, class to built-in type, and
class to class type conversion.
Instructions:
Q13. Write a program using all control statements: if, else-if, switch, break, continue, and
loops.
Instructions:
Instructions:
Instructions: