Sub
Name: Object Oriented Programming Using UML & C++
Sub
Code: TBC 302
PHASE
IV
CONSTRUCTOR
Q1. WAP to demonstrate the use of
Different types of Constructors in class NUMBER
NUMBER ()
NUMBER (int a)
NUMBER (int a int b)
NUMBER
(NUMBER & A)
Q2. WAP to demonstrate the use of
Destructor in class NUMBER
~ NUMBER ()
Q3.
Create a class called DISTANCE that
has separate member data inches and feet. One constructor should
initialize this data to 0, and another should initialize it to fixed values. A
member function should display it. The member function should add two objects
of type distance passed as arguments. A main ( ) program should create two
initialized distance objects, and one that isn’t initialized. Then it should
add the two initialized values together, leaving the result in the third
distance variable. Finally display the third variable.
INHERITANCE
Q4. WAP to show multiple inheritance eg, person, faculty
and student class.
Q4. Create two classes DM and DF, which store the
value of distances. DM stores distances in meters and centimeters and DF in
feet and inches. Write a program that can read values for the class object and
add one object of DM with another object of DF. Use a friend function to carry
out the addition operation. The object that stores the results may be a DM
object or DF object, depending on the units in which results are required. The
display should be in the format of feet and inches or meters and centimeters
depending on the object on display.
Q5.Write a
program to read and display information about employees and managers. Employee
is a class that contains employee number, name, address and department. Manager
class contains all information of the employee class and list of employees
working under manager.
Q6. What is
virtual function and how it is used to implement late binding? How will you
make a class as an abstract class?
a)WAP to design
three classes Figure, Line, Square
Figure:
Name
Color
virtual
Getdata()
Disp()
Line:
Name
Color
Getdata()
Disp()
Square:
Name
Color
Side
Area
Getdata()
Disp()
Calc_Area()
Q7. WAP to
design three classes Figure, Line, Square.
Figure:
Name
Color
virtual
Getdata() =0;
Disp()
Line:
Name
Color
Getdata()
Disp()
Square:
Name
Color
Side
Area
Getdata()
Disp()
Calc_Area()
GENERIC
PROGRAMMING
Q8. Write a C++ program to create a template
function for BUBBLE_SORT and demonstrate sorting of integers and doubles.
Q9. Write a Function Template for the FIND_MAX function,
that finds max of three int, three float and three double value types
Q10.Write a Class Template for the array that can have int, float and double value types as data
members.
No comments:
Post a Comment