Chapter 9 Flashcards

1
Q

What is destructor

A

Destructor is used to free the memory that is allocated through dynamic memory allocation. It destroy object when it goes out of scope. Destructor name is same as class name with ~ as prefix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Destructors can not be overloaded. True of FALSE

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How destructor called

A

In reverse order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are accessor functions

A

Accessor functions are functions that are used to access data members that are defined in private.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is ‘this’ pointer

A

It is pointer to object. So if there are 100 objects in memory of a program, when a specific object calls its function, compiler send a parameter automatically which tells which object is called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which variable is called this pointer

A

The variable that contains self-address is called this pointer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the deceleration of this pointer

A

datatype * const this;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly