OOP Quiz 4

studied byStudied by 11 people
5.0(1)
Get a hint
Hint

template function and classes

1 / 35

flashcard set

Earn XP

Description and Tags

Object Oriented Programming Quiz 4 12/6/2022

36 Terms

1

template function and classes

enable programs to work on many different data types without being rewritten for each one.

New cards
2

parameterize

templates provide the capability to ___________ types in functions and classes

New cards
3
tempate<typename T>

define generic types for a class

New cards
4

generic types, concrete types

You can define functions or classes with __________ that can be substituted for ___________ by the compiler

New cards
5

default type

can assign a ________ for a type parameter

New cards
6

array limitation

The array size is fixed when the array is created

New cards
7

push back(): void

Appends the element in this vector

New cards
8

pop back(): void

Removes the last element from this vector

New cards
9

size(): unsigned const

Returns the number of elements in this vector

New cards
10

at(): elementType const

Returns the element at the specified index in this vector

New cards
11

empty() bool const

returns true if vector is empty

New cards
12

clear(): void

Removes all elements from this vector

New cards
13

swap(): void

Swaps the contents of this vector with the specified vector

New cards
14

operator overloading

Providing a user-defined meaning to a pre-defined operator (e.g., +, ==, <<) for a user-defined type (e.g., a class)

New cards
15

Defining functions for operators

New cards
16

Operators

Functions defined in a class

New cards
17

operator

These functions are named with keyword _________ followed by the actual operator.

New cards
18

Inheritance

Define new classes from existing classes

New cards
19

base class

a general class, not accessible outside the class

New cards
20

derived class

specialized class

New cards
21

accessor/mutator

base classes can be accessed through public _____ if defined in base class

New cards
22

constructor

The _________ of a derived class first calls its base class's constructor before it executes its own code.

New cards
23

destructor

The ______________ of a derived class executes its own code then automatically calls its base class's _____________.

New cards
24

derived

Constructors can only be called from the constructors of the _______ classes to initialize the data fields.

New cards
25

Constructor Chaining

Constructing an instance of a class invokes all the superclasses' constructors along the inheritance chain

New cards
26

Destructor Chaining

When an object of a derived class is destroyed the derived class destructor is called. Then it invokes the base class destructor

New cards
27

Inheritance Hierarchy

A set of hierarchical relationships between classes of objects

New cards
28

Redefining function

function in a derived class that has the same name and parameter list as a function in the base class

New cards
29

Overloading Functions

The functions have the same name but different parameter lists.

New cards
30

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

New cards
31

Polymorphism

A variable of a supertype can refer to a subtype object.

New cards
32

Supertype

A generic entity that has a relationship with one or more subtypes

New cards
33

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.

New cards
34

Inheritance Chain

A polymorphic function can be implemented in several classes along this

New cards
35

dynamic binding

type of object is not determined until run-time

New cards
36

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

New cards

Explore top notes

note Note
studied byStudied by 25 people
... ago
5.0(1)
note Note
studied byStudied by 7375 people
... ago
4.6(5)
note Note
studied byStudied by 8 people
... ago
5.0(1)
note Note
studied byStudied by 34 people
... ago
5.0(1)
note Note
studied byStudied by 14 people
... ago
5.0(1)
note Note
studied byStudied by 5 people
... ago
5.0(1)
note Note
studied byStudied by 10 people
... ago
5.0(1)

Explore top flashcards

flashcards Flashcard (20)
studied byStudied by 10 people
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 18 people
... ago
5.0(2)
flashcards Flashcard (76)
studied byStudied by 9 people
... ago
5.0(1)
flashcards Flashcard (44)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (26)
studied byStudied by 52 people
... ago
5.0(2)
flashcards Flashcard (31)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (88)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (51)
studied byStudied by 6 people
... ago
5.0(1)
robot