Quiz


1.  

What is inheritance?

inheritance is a programming technique that enables a class to inherit some or all attributes and behaviors of another class.

2.  

What is simple inheritance?

simple inheritance is a type of inheritance in which a class inherits from just one class.

3.  

What is level inheritance?

level inheritance is a type of inheritance in which two or more levels of inheritance exist. each level consists of a parent-child relationship whereby the child of the middle level is also the parent of the lower level. the last child in level inheritance inherits directly and indirectly from other levels.

4.  

What is multiple inheritance?

multiple inheritance is a type of inheritance in which a child inherits from multiple parents, but no relationship exists among those parents.

5.  

What is the is a test?

the is a test is given to determine if a child is a parent. for example, is a graduate student a student? if so, the child (graduate student) can inherit from the parent (student). if not, the child cannot inherit from the parent.

6.  

When would you use multiple inheritance?

multiple inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are not related to each other.

7.  

When would you use level inheritance?

level inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are related to each other.

8.  

What is the maximum number of levels in level inheritance?

there is no maximum number of levels in level inheritance. however, you should use no more than three levels; otherwise, you run the risk that the levels will become unmanageable.

9.  

What members of a class can another class inherit?

a child can inherit public and protected members of a parent class.

10.  

What is the difference between base class/derived class and super class/subclass?

base class is the term used in c++ to refer to a parent class. derived class is the c++ term for a child class. a super class is java s parent class, and java s child class is called a subclass.

Answers

1.  

Inheritance is a programming technique that enables a class to inherit some or all attributes and behaviors of another class.

2.  

Simple inheritance is a type of inheritance in which a class inherits from just one class.

3.  

Level inheritance is a type of inheritance in which two or more levels of inheritance exist. Each level consists of a parent-child relationship whereby the child of the middle level is also the parent of the lower level. The last child in level inheritance inherits directly and indirectly from other levels.

4.  

Multiple inheritance is a type of inheritance in which a child inherits from multiple parents, but no relationship exists among those parents.

5.  

The is a test is given to determine if a child is a parent. For example, is a graduate student a student? If so, the child (graduate student) can inherit from the parent (student). If not, the child cannot inherit from the parent.

6.  

Multiple inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are not related to each other.

7.  

Level inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are related to each other.

8.  

There is no maximum number of levels in level inheritance. However, you should use no more than three levels; otherwise , you run the risk that the levels will become unmanageable.

9.  

A child can inherit public and protected members of a parent class.

10.  

Base class is the term used in C++ to refer to a parent class. Derived class is the C++ term for a child class. A super class is Java s parent class, and Java s child class is called a subclass.




OOP Demystified
OOP Demystified
ISBN: 0072253630
EAN: 2147483647
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net