C++ Ch 11

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Public members of a base class can be inherited as what?

public or private members of the derived class

Composition (aggregation) has what kind of relation?

"has-a"

What is an example of the inheritance relationship?

"is-a" relationship - every employee is a person

Use the preprocessor command ________ to include a header file in a program.

#include

From the list of verbs choose _________.

0perations

What are the fundamental principles of object-oriented design (OOD) (3)?

1. encapsulation 2. inheritance 3. polymorphism

What are two common ways to relate two classes in a meaningful way?

1. inheritance ("is-a" relationship) 2. composition or aggregation ("has-a" relationship)

If derived class overrides a public member function of the base class, then to call the base class function, specify (3):

1. name of base class 2. scope resolution operator 3. function name with appropriate parameter list

What is it called when all public members of a base class are inherited as public members of a derived class?

public inheritance

When a derived class object goes out of scope, what is automatically invoked?

its destructor

All member variables of the base class are what to the derived class?

member variables

What is constructed before the containing class objects are constructed?

member-objects

istream and ostream provide operations for data transfer between what?

memory and devices

What is it called when a derived class has multiple base classes?

multiple inheritance

To find classes begin with what?

a problem description, and identify all nouns and verbs

What is the syntax of a derived class?

class className: memberAccessSpecifier baseClassName { member list };

C++ supports OOP through the use of what?

classes

From the list of nouns choose __________.

classes

OOD encourages what?

code reuse

What is encapsulation?

combining data and operation on data in a single unit

When a derived object is declared, it must execute one of the base class ___________.

constructors

How is a public member function redefined?

corresponding member function in derived class must have the same name/number/types of parameters

Ostream defines the insertion operator (<<), which is used by _______.

cout

What is inheritance?

creating new objects (classes) from existing objects (classes)

Destructors are used to do what?

deallocate dynamic memory allocated by the object of the class

To give a derived class direct access to private members of the base class, what must be done?

declare the private members of the base class protected

In OOD, an object is a fundamental __________. Debugging happens at the _________ level. A program is a collection of interacting ___________.

entity; class; objects

Inheritance allows the creation of new classes from what?

existing classes

Public members form the _________ state.

external

ifstream/ofstream objects are for what?

file I/O

What header file contains the definitions for ifstream/ofstream?

fstream

istream defines the extraction operator (>>) and functions ___________ & ___________.

get; ignore

Call to base class constructor is specified in ___________ of derived class constructor definition.

heading

Inheritance can be viewed as a ____________ structure between its base classes and its derived classes.

hierarchical

C++ provides virtual functions to implement polymorphism in an ___________ hierarchy.

inheritance (allows run-time selection of appropriate member functions)

Private members form the ________ state.

internal

Derived classes cannot directly access private members of what?

its base class

Derived classes inherit its properties from what?

its base class

What are derived classes?

new classes created from existing ones

Every _________ has an internal state and an external state.

object

Only the ________ can manipulate its internal state.

object

In composition, one or more members of a class are __________ of another class type.

objects

__________ are created when class variables are declared.

objects

___________ interact with each other via function calls.

objects

Templates provide _________ polymorphism.

parametric

The member access specifier is public, protected, or __________ (default).

private

What is it called when a derived class has a single base class?

single inheritance

Inheritance helps reduce what?

software complexity

ios is the base class for all _________ classes.

stream

What is polymorphism?

the ability to use the same expression to denote different operations

Private members of a base class are private to what?

the base class (derived class cannot directly access them)

Derived class constructor cannot directly access private members of what?

the base class (it can directly initialize only public members of the base class)

When the destructor of the derived class executes, what is automatically invoked?

the destructor of the base class

Arguments to the constructor of a member-object are specified where?

the heading part of the definition part of the constructor

Member-objects of a class are constructed in what order?

the order they are declared (not in the order in the constructor's member initialization list)

What are base classes?

the original class

How is a new class defined?

through the creation of new header files

To create new derived classes, include commands that specify what?

where the base definitions can be found

Can definitions of member functions be placed in a separate file?

yes

In C++, can function names and operators be overloaded?

yes

Can derived classes redefine public member functions of the base class?

yes (applies only to the objects of the derived class)

Do polymorphic functions or operators have many forms?

yes - example: division with floating point and division with integer operands


Set pelajaran terkait

Module 17: Sole Proprietership, Partnership, and Corporation—Advantages and Disadvantages

View Set

Psychopharmacology Quiz 7 (Psychotic Disorders and Antipsychotics)

View Set

Personal Finance Exam 2 Chapter 9

View Set

Pearson Educational Research Mills and Gay Final Exam

View Set

Life Insurance Chapter 3 Life insurance Policies

View Set

Active Learning - Reproductive System

View Set

Oral Care Case Study and Quiz ATI

View Set