C++ Flashcards
Union
Similar to a structure
All members share same memory
Only one member can be defined at a time
Typedef
New name for existing data type
Reference
Alias for another variable
Can’t be reassigned
Doesn’t require dereference (*) operator to access data
Can’t hold null value
New
Calls constructors
Returns exact datatype
Initializes memory
List VS Array
Lists don’t have fixed size
Lists require more memory (addresses)
Lists are allocated dynamically
Malloc
No constructors, just allocates a certain amount of memory
Returns a void pointer
Virtual Function
Function that can be overridden in sub-classes
Can include a definition
Pure virtual Function
Virtual function with no definition
Makes base class abstract
Abstraction
Showing only necessary details
Encapsulation
Grouping data and code together
Inheritance
Deriving properties from a base class
Multiple Inheritance
Inheriting properties from multiple classes
Virtual Inheritance
Making sure that only one copy of a class is include in an inheritance hierarchy that uses multiple inheritance
Polymorphism
Multiple forms of the same thing
Compile Time polymorphism
Function Overloading
Operator Overloading
“Early Binding”
Run Time polymorphism
Function Overriding
Virtual Functions
“Late Binding”
Classes
User defined Datatypes
Object
Instance of a class
Constructor
Initializes an object
Function in a class
There are no virtual constructors
Default constructor
Constructor with no parameters or arguments.
Parameterized Constructor
Constructor with parameters
Copy Constructor
Member function that initializes on object using another object of the same class
Three types of constructors
Default
Parameterized
Copy
Destructor
Deletes an object when it goes out of scope