It's about life

Chapter 12

Support for Object-Oriented Programming

Assignment from Tri Djoko Wahjono

Review Questions

1. Describe the three characteristic features of object-oriented languages.
Abstract data types, Inheritance and Polymorphism.

2. What is the difference between a class variable and an instance variable?
The difference between instance and class variables is. Class variables only have one copy that is shared by all the different objects of a class, whereas every object has it’s own personal copy of an instance variable. So, instance variables across different objects can have different values whereas class variables across different objects can have only one value.

3. What is multiple inheritance?
An inheritance which allows a new class to inherit from two or more classes

4. What is a polymorphic variable?
A polymorphic variable can be defined in a class that is able to reference (or point to) objects of the class and objects of any of its descendants

5. What is an overriding method?
Overriding method is a method that purpose is provide an operation in the subclass that is similar to one in the parent class, but is customized for objects of the subclass.

7. What is a virtual method?
Virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.

8. What is an abstract method? What is an abstract class?
An abstract method is one that does not include a definition (it only defines a protocol). An abstract class is one that includes at least one virtual method. An abstract class cannot be instantiated

9. Describe briefly the eight design issues used in this chapter for objectoriented languages.
The Exclusivity of Objects
Are Subclasses Subtypes?
Type Checking and Polymorphism
Single and Multiple Inheritance
Object Allocation and Deallocation
Dynamic and Static Binding
Nested Classes
Initialization of Objects

10. What is a nesting class?
Nesting class is a class whose definition appears inside the definition of another class, as if it were a member of the other class.

11. What is the message protocol of an object?
Message protocol of an object is the entire collection of methods of an object

Problem Set

3. Compare the dynamic binding of C++ and Java.
In C++, a method can only be dynamically bound if all of its ancestors are marked virtual. Be default, all method binding is static. In Java, method binding is dynamic by default. Static binding only occurs if the method is marked final, which means it cannot be overriden.

5. Compare the class entity access controls of C++ and Ada 95.
C++ has extensive access controls to its class entities. Individual entities can be marked public, private, or protected, and the derivation process itself can impose further access controls by being private. Ada, on the other hand, has no way to restrict inheritance of entities (other than through child libraries, which this book does not describe), and no access controls for the derivation process.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


This entry was posted on June 28, 2013 by and tagged .
June 2013
« Apr   Sep »

Blog Stats

  • 10,673 hits
%d bloggers like this: