enable programs to work on many different data types without being rewritten for each one.
2
New cards
parameterize
templates provide the capability to ___________ types in functions and classes
3
New cards
tempate
define generic types for a class
4
New cards
generic types, concrete types
You can define functions or classes with __________ that can be substituted for ___________ by the compiler
5
New cards
default type
can assign a ________ for a type parameter
6
New cards
array limitation
The array size is fixed when the array is created
7
New cards
push back(): void
Appends the element in this vector
8
New cards
pop back(): void
Removes the last element from this vector
9
New cards
size(): unsigned const
Returns the number of elements in this vector
10
New cards
at(): elementType const
Returns the element at the specified index in this vector
11
New cards
empty() bool const
returns true if vector is empty
12
New cards
clear(): void
Removes all elements from this vector
13
New cards
swap(): void
Swaps the contents of this vector with the specified vector
14
New cards
operator overloading
Providing a user-defined meaning to a pre-defined operator (e.g., +, ==, <
15
New cards
Defining functions for operators
16
New cards
Operators
Functions defined in a class
17
New cards
operator
These functions are named with keyword _________ followed by the actual operator.
18
New cards
Inheritance
Define new classes from existing classes
19
New cards
base class
a general class, not accessible outside the class
20
New cards
derived class
specialized class
21
New cards
accessor/mutator
base classes can be accessed through public _____ if defined in base class
22
New cards
constructor
The _________ of a derived class first calls its base class's constructor before it executes its own code.
23
New cards
destructor
The ______________ of a derived class executes its own code then automatically calls its base class's _____________.
24
New cards
derived
Constructors can only be called from the constructors of the _______ classes to initialize the data fields.
25
New cards
Constructor Chaining
Constructing an instance of a class invokes all the superclasses' constructors along the inheritance chain
26
New cards
Destructor Chaining
When an object of a derived class is destroyed the derived class destructor is called. Then it invokes the base class destructor
27
New cards
Inheritance Hierarchy
A set of hierarchical relationships between classes of objects
28
New cards
Redefining function
function in a derived class that has the same name and parameter list as a function in the base class
29
New cards
Overloading Functions
The functions have the same name but different parameter lists.
30
New cards
Redefining vs. Overloading
Overloading a function is a way to provide more than one function with the same name but with different signatures to distinguish them. To redefine a function, the function must be defined in the derived class using the same signature and the same return type as in its base class
31
New cards
Polymorphism
A variable of a supertype can refer to a subtype object.
32
New cards
Supertype
A generic entity that has a relationship with one or more subtypes
33
New cards
Subtype
A subgrouping of the entities in an entity type that is meaningful to the organization and that shares common attributes or relationships distinct from other subgroupings.
34
New cards
Inheritance Chain
A polymorphic function can be implemented in several classes along this
35
New cards
dynamic binding
type of object is not determined until run-time
36
New cards
two steps for dynamic binding
1) Function must be defined virtual in the base class 2) The variable that references the object must be passed by reference or passed as pointer in the virtual function