Tutorial Sheet OOPS in C++
Tutorial Sheet OOPS in C++
Tutorial Sheet : 02
Tutorial Sheet : 03
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
Constructors, Destructors
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
Tutorial Sheet : 06
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
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
o Create a C++ program using virtual function get the information about N
no of persons and find whether they are outstanding or not.
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.