Constructor, Destructor, Operator and Function Overloading

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

flashcard set

Earn XP

Description and Tags

Flashcards created from lecture notes on Constructor, Destructor, Operator and Function Overloading.

Other

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

__: Making an instance of the class/type. Instances have allocated memory to store specific information. There can be multiple identical instances of the same type.

Instantiation

2
New cards

For each class instance, is when it is created, sets up necessary stuff; and is when it is destroyed (freed), cleans up the stuffs.

Constructor; Destructor

3
New cards

__ are special member functions used to initialize the object, and they have the same name as the class and no return type, but can take different arguments.

Constructors

4
New cards

The __ is a special cleanup member function that is called when the object is destroyed, its name is '~' + the class name, and takes no arguments and has no return type.

Destructor

5
New cards

A __ is a constructor that initializes an object using another instance of the same class. ClassName(const ClassName& obj);

Copy constructor

6
New cards

A __ is implicitly created by the compiler if there is no user-defined copy constructor, and performs a member-wise copy between objects, where each member is copied by its own copy constructor.

Default copy constructor

7
New cards

Note: A __ is implicitly created by compiler only if there is no user-defined constructor.

Default constructor

8
New cards

In member functions, __ can be used to point to the instance itself, and is useful when you need to return the pointer or reference to the instance.

this

9
New cards

__ pertain to the class, not to individual instances. Static member variables are shared among all instances. Static member functions do not have an associated instance, so you can only see the static member variables.

Static members

10
New cards

Functions that do the same thing but using different argument lists are known as __.

Function Overloading

11
New cards

C++ allows you to redefine built-in operators like +, -, *, … An __ is a special function form to overload an operator. operatorX(arguments…);

Operator function

12
New cards

A __ is implicitly created by compiler if there is no user-defined assignment operator, and does a member-wise copy between objects, where each member is copied by its own assignment operator.

Default assignment operator

13
New cards

__ allow binary search for fast lookup, addition, and removal of data items

BST

14
New cards

__ rule: The left subtree of a node contains only nodes with keys smaller than its key. The right subtree of a node contains only nodes with keys greater than its key. The left and right subtree each must also be a BST. There must be no duplicate nodes.

BST