You are on page 1of 2

(3x) Section 11-2) Why does using static variables violate the principle of

encapsulation? (That's objects using public and private to protect who has access to their
internals.)
Because encapsulation says the data should be accessed only by required set of elements,
but global variable is accessible everywhere, also it is most prone to changes. It doesn’t hide the
internal working of program.
If using access declaration for private members of base class was allowed in
programming, it would have destroyed whole concept of encapsulation.

(3x) Section 11-3) Why does using the friend keyword violate the principle of cohesion? (That's
classes being able to operate independently without connections to outside classes.)

(3x) Section 11-6) Why does overloading operators violate the principle of readability?

11.39) What is the difference between private members and protected members?
Private members are only available to be accessed within the class that defines them.

Protected members are accessible in the class that defines them and in other classes
which inherit from that class.

6) A(n) __________ tells the compiler that a specific class will be declared later in the program.
forward declaration

20) What is the purpose of a forward declaration of a class?


The purpose is to tell the compiler that a class with that name will be declared later in the
program.

15.7) How can you tell from looking at a class declaration that a virtual member function is
pure?
The body of the function is replaced with = 0;

15.8) What makes an abstract class different from other classes?


Instantiate objects can’t use in an abstract class.

2) A member function of a class that is not implemented is called a(n) _________ function.
Pure virtual

3) A class with at least one pure virtual member function is called a(n) _________ class.
Abstract class

9) The is-a relation between classes is best implemented using the mechanism of class
_________.
Inheritance

10) The has-a relation between classes is best implemented using the mechanism of class
_________.
Composition

11) If every C1 class object can be used as a C2 class object, the relationship between the two
classes should be implemented using _________.
Inheritance