Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
55 views2 pages

Constructor Vs Member Function

The document outlines different topics covered on various dates ranging from operating systems and networking to database, object-oriented programming, data structures and algorithms, and artificial intelligence. It also lists subjects like Islamic studies, Pakistan studies, everyday science, and Urdu. The remainder of the document discusses object-oriented programming concepts like data types, constructors, the difference between constructors and member functions, and the two types of constructors - default and parameterized.

Uploaded by

Rashid Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Constructor Vs Member Function

The document outlines different topics covered on various dates ranging from operating systems and networking to database, object-oriented programming, data structures and algorithms, and artificial intelligence. It also lists subjects like Islamic studies, Pakistan studies, everyday science, and Urdu. The remainder of the document discusses object-oriented programming concepts like data types, constructors, the difference between constructors and member functions, and the two types of constructors - default and parameterized.

Uploaded by

Rashid Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

26-27 Operating system

28-29 Networking

30-1-2-3 Database

4-5-6 Oop

7-8-9 Data structure and algo

10-11-12 Artificial intelligence

13-14-15-16-17 Software engine

18-30 Islamic study

Pak study

Everyday science

Urdu

Oop concepts

bool: For booleans, true or false.

char: For characters. Size 1 byte.

int: For integers. Size 2 bytes.

float: For floating point. Size 4 bytes.

double: floating point. Size 8 bytes

Constructor is a special member function of a class that initializes the


object of the class. Constructor name is same as class name and it doesn’t
have a return type. Lets take a simple example to understand the working
of constructor.

Constructor vs Member function


Now that we know what is constructor, lets discuss how a constructor is
different from member function of the class.
1) Constructor doesn’t have a return type. Member function has a return
type.
2) Constructor is automatically called when we create the object of the
class. Member function needs to be called explicitly using object of class.
3) When we do not create any constructor in our class, C++ compiler
generates a default constructor and insert it into our code. The same does
not apply to member functions.
This is how a compiler generated default constructor looks:

Types of Constructor in C++


There are two types of constructor in C++. 1) Default constructor 2)
Parameterized constructor

1) Default Constructor
A default constructor doesn’t have any arguments (or parameters)

2) Parameterized Constructor
Constructors with parameters are known as Parameterized constructors.
These type of constructor allows us to pass arguments while object
creation. Lets see how they look:

You might also like