Object Oriented Programming Lab: Gautam Buddha University

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

1

GAUTAM BUDDHA UNIVERSITY

OBJECT ORIENTED
PROGRAMMING LAB
CS285

B. TECH CSE (2ND YEAR)


PRACTICAL FILE

SUBMITTED BY:
NAME: ARYAN GUPTA
ROLL NO: 20/BCS/014

SUBMITTED TO:
MR. ABHISHEK KUMAR
2

INDEX

S. NO. NAME OF EXPERIMENT PAGE NO. SIGNATURE


01. Write a program to demonstrate the 03
Constructor Overloading, assume desired
parameters.

02. Write a program demonstrating the public, 04


protected and private parameters.
03. Write a program to demonstrate 05
constructor with default argument.
04. Write a program to demonstrate destructor 06
in inheritance.
05. Write a program to demonstrate multiple 07
inheritances.
06. Write a program to demonstrate 09
constructor call in the derived class.
07. Write a program to demonstrate destructor 10
call in the derived class
08. Write a C++ Program to append the 12
content of a file.
09. Write a C++ Program to create a file. 13
10. Write a program in C++ to demonstrate 14
virtual function.
11. Write a program in C++ to demonstrate 15
friend value.
12. Write a program to implement an Account 16
Class with member functions to Compute
Interest, Show Balance, Withdraw and
Deposit amount from the Account.

13. Write a program to implement a class 19


‘Complex’ of complex numbers. The class
should be included member functions to
add and subtract two complex numbers.

14. Write a program to implement a sphere 21


class with appropriate members and
member function to find the surface area
and the volume.

15 Write a c++ program to implement a class 22


for complex number with add and multiply
as member function. Overload ++operator
to increment a complex number.
3

EXPERIMENT- 01

OBJECTIVE:
Write a program to demonstrate the Constructor Overloading, assume desired
parameters.

PROGRAM CODE:

OUTPUT:
4

EXPERIMENT- 02

OBJECTIVE:
Write a program demonstrating the public, protected and private parameters.

PROGRAM CODE:

OUTPUT:
5

EXPERIMENT- 03

OBJECTIVE:
Write a program to demonstrate constructor with default argument.

PROGRAM CODE:

OUTPUT:
6

EXPERIMENT- 04

OBJECTIVE:
Write a program to demonstrate destructor in inheritance.

PROGRAM CODE:

OUTPUT:
7

EXPERIMENT- 05

OBJECTIVE:
Write a program to demonstrate multiple inheritances.

PROGRAM CODE:
8

OUTPUT:
9

EXPERIMENT- 06

OBJECTIVE:
Write a program to demonstrate constructor call in the derived class.

PROGRAM CODE:

OUTPUT:
10

EXPERIMENT- 07

OBJECTIVE:
Write a program to demonstrate destructor call in the derived class.

PROGRAM CODE:
11

OUTPUT:
12

EXPERIMENT- 08

OBJECTIVE:
Write a C++ Program to append the content of a file.

PROGRAM CODE:

OUTPUT:
13

EXPERIMENT- 09

OBJECTIVE:
Write a C++ Program to create a file.

PROGRAM CODE:

OUTPUT:
14

EXPERIMENT- 10

OBJECTIVE:
Write a program in C++ to demonstrate virtual function.

PROGRAM CODE:

OUTPUT:
15

EXPERIMENT- 11

OBJECTIVE:
Write a program in c++ to demonstrate friend value.

PROGRAM CODE:

OUTPUT:
16

EXPERIMENT- 12

OBJECTIVE:
Write a program to implement an Account Class with member functions to
Compute Interest, Show Balance, Withdraw and Deposit amount from the
Account.

PROGRAM CODE:
17
18

OUTPUT:
19

EXPERIMENT- 13

OBJECTIVE:
Write a program to implement a class ‘Complex’ of complex numbers. The
class should be included member functions to add and subtract two complex
numbers.

PROGRAM CODE:
20

OUTPUT:
21

EXPERIMENT- 14

OBJECTIVE:
Write a program to implement a sphere class with appropriate members and
member function to find the surface area and the volume.

PROGRAM CODE:

OUTPUT:
22

EXPERIMENT- 15

OBJECTIVE:
Write a c++ program to implement a class for complex number with add and
multiply as member function. Overload ++operator to increment a complex
number.

PROGRAM CODE:
23

OUTPUT:

You might also like