G. H. Raisoni college of engineering, nagpur



Download 117.52 Kb.
Page1/2
Date17.12.2020
Size117.52 Kb.
#55034
  1   2
PracticalNo.2 3rd Sem B 28

G. H. RAISONI COLLEGE OF ENGINEERING, NAGPUR

(An Autonomous Institute affiliated to Rashtrasant Tukdoji Maharaj, Nagpur University, Nagpur)

Department of Computer Science & Engineering




Date: 14/09/2020
Practical Subject: Object Oriented Programming

Session: 2020-21
Student Details:

Roll Number

28

Name

Mayank Agarwal

Semester

3rd

Section

B

Branch

CSE



Practical Details: Practical Number- 2

Practical Aim

Implementation of Constructor and Destructor : Constructor Overloading

1. Default Constructor

2. Parameterized Constructor

3. Copy Constructor

4. Constructor overloading

5. Destructor
Problem Definition: Create an ATM Machine using concept of different type of constructor and destructor. Study the concept how ATM Machine maintains a data and implement a concept accordingly

Theory

Constructor

A Constructor is a member function of a class. It is mainly used to initialize the objects of the class. It has the same name as the class. When an object is created, the constructor is automatically called. It is a special kind of member function of a class.

Difference Between Constructor and Other Member Functions:

1. The Constructor has the same name as the class name.


2. The Constructor is called when an object of the class is created.
3. A Constructor does not have a return type.
4. When a constructor is not specified, the compiler generates a default constructor which does nothing.
5. There are 3 types of constructors:

  •  Default Constructor

  • Parameterized Constructor

  • Copy constructor

A constructor can also be defined in the private section of a class.


Download 117.52 Kb.

Share with your friends:
  1   2




The database is protected by copyright ©ininet.org 2024
send message

    Main page