KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 02
Subject: Object Oriented Techniques
Program with functions
o Some simple C++ programs.
o Create a C++ program to have a function to calculate the simple interest
for a customer with default arguments.
o Create a C++ program to swap 2 integer numbers using functions and call
by value, call by address and call by reference methods.
o Create a C++ program to swap 2 Student structures using functions and
call by value, call by address and call by reference methods.
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 03
Subject: Object Oriented Techniques
Some Simple C++ Programs with class, objects, constructors and destructors.
o Create a C++ program to have a Class named set with 2 numbers and
perform the various operations to find Max, Min, Add, Sub using methods.
o Create a C++ program to have a Class employee with name, age,
designation. Write a function to get & display ‘n’ number of employees.
o Create a C++ program to have a Class State with its name and capital and
perform the operations of getinfo(), displayinfo(), search(name),
search(capital) using methods.
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 04
Subject: Object Oriented Techniques
Constructors, Destructors
o Create a C++ program to have an Shopping list with itemcode[10],
itemprice[10], count and with operations like add item to my shopping
bag, remove item from bag, display content of bag, calculate total, count
items, order items and quit.
o Create a C++ program to have a class named add_nos and get the values
for the number variables through constructor and perform the addition of
them. Check whether they are deleted at the time of destructor. Perform
Copy Constructor of one object into other object.
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 05
Subject: Object Oriented Techniques
Function & Operator Overloading
o Create a C++ program to overload the function ‘Volume’ to perform
Volume calculation of various shapes.
o Create a C++ program to overload unary minus operator to a class with 3
data members.
o Create a C++ program to overload the + operator to perform the
addition of two strings.
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 06
Subject: Object Oriented Techniques
o Create a C++ program to overload the + operator to perform the addition of 2
complex numbers.
o Write a C++ program to overload the ‘>’ operator on a string class to check
whether the given first string is greater than the second string. s1,s2 are string
class objects.
if (s1>s2)
cout<<”First string is greater than second string”;
else
cout<<” First string is not greater than second string”;
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 07
Subject: Object Oriented Techniques
Inheritance
o Create a C++ program to have a class named student and inherit a class
named Test from it which contains mark details for each student and
derive a class named result to put grade for each student. Perform Single
and Multilevel inheritances.
o Create a C++ program to show the Hybrid inheritance and virtual base
class.
STUDENT
TEST SPORTS
GRADE
KRISHNA ENGINEERING COLLEGE, GHAZIABAD
Tutorial Sheet : 08
Subject: Object Oriented Techniques
o Create a C++ program using virtual function get the information about N
no of persons and find whether they are outstanding or not.
PERSON Outstanding() – Virtual function
PROFESSOR STUDENT
o Create a C++ program to have a class named Media with a virtual function
Display. Inherit the classes Book and Tape from Media class. Using the
Virtual function Display, show the details of Book and Tape.