OOP Using C++ Practical Mannual
OOP Using C++ Practical Mannual
PRACTICAL LIST
CO1. Understanding the features of C++ supported object oriented programming & implementation of
operator overloading.
1 WAP in C++ to create a class called as student. Data members are roll_no, name & 01
fees of the student. Write appropriate get () & put () functions to scan and display
the student data.
2 WAP in C++ to create a class called as employee. Data members are eid, sal & 01
name of the employee. Scan the data for 10 such employees & display the same by
using array of objects.
3 WAP in C++ to create a class called as Book. Data members are name of the Book 01
& price. Write default, parameterized & copy constructors to initialize & display
Book object values.
4 WAP in C++ to create a class called as Distance, members are ft & in. Assign 01
appropriate values to objects D1 & D2 and add their values by overloading binary
‘+’ operator to store the result in D3.
5 WAP in C++ to create a class called as student, having member as roll_no & name 02
of the student. Create another class Exam having members as mark1 & mark2.
Finally create a class called result which is derived from student & Exam.
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Write a show function in it to show student info & percentage of marks scored
using Multiple Inheritance.
6 WAP in C++ to demonstrate Derived class constructor. 02
7 WAP in C++ to implement friend function acting as a bridge between the two 02
classes.
8 WAP in C++ to implement Virtual function for function overriding. 02
9 WAP in C++ to overload insertion (>>) & extraction (<<) operators for objects. 03
10 WAP to implement function Template. 03
Subject Teacher
(Dr Vijay B Gadicha)
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Practical No 01
Problem Definition WAP in C++ to create a class called as student. Data members are rollno, name &
fees of the student. Write appropriate get () & put () functions to scan and display
the student data.
Result This program demonstrates the creation of classes & objects in C++.
Practical No 02
Problem WAP in C++ to create a class called as employee. Data members are eid, sal & name of
Definition the employee. Scan the data for 10 such employees & display the same by using array
of objects.
Input :
1 8000 Edward
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Practical No 03
Problem Definition WAP in C++ to create a class called as Book. Data members are name of the
Book & price. Write default, parameterized & copy constructors to initialize &
display Book object values.
b3.show();
}
Output:
Intro to C++
1000
Intro to C++
1000
Intro to C++
1000
Practical No 04
Problem Definition WAP in C++ to create a class called as Distance, members are ft & in. Assign
appropriate values to objects D1 & D2 and add their values by overloading binary
‘+’ operator to store the result in D3.
main()
{
dist d1, d2,d3;
d1.getd();
d2.getd();
d3=d1+d2;
d3.show();
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Practical No 05
Problem Definition WAP in C++ to create a class called as student, having member as roll_no &
name of the student. Create another class Exam having members as mark1 &
mark2. Finally create a class called result which is derived from student & Exam.
Write a show function in it to show student info & percentage of marks scored
using Multiple Inheritance.
main()
{
result r;
r.get();
r.show();
}
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Output :-
12GarryPer84
Result This example demonstrates multiple inheritance in C++.
Practical No 06
Result Here, we have implemented the class called as base, inherited this base class into
derived class to demonstrate the derived class constructor mechanism.
Practical No 07
Title/Aim Implementing friend function acting as a bridge between the two classes in C++.
Problem Definition WAP in C++ to implement friend function acting as a bridge between the two
classes.
Result This C++ program demonstrates the functionality of friend function acting as a
bridge between the two classes.
Practical No 08
Problem Definition WAP in C++ to implement Virtual function for function overriding.
This is triangle.
Result Here, we have implemented a class called as Shape, Circle & Triangle using
virtual function for function overriding in C++.
Conclusion Here, we have implemented virtual function for function overriding in C++.
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Practical No 09
Problem Definition WAP in C++ to overload insertion (>>) & extraction (<<) operators for objects.
x 11 3.14
Result Here, we have overloaded insertion (>>) and extraction (<<) operators for objects
in C++.
Conclusion Here, we have implemented insertion and extraction operators for objects in C++.
G H RAISONI UNIVERSITY, AMRAVATI
Anjangaon Bari Road, Amravati - 444701
Practical No 10