Rickvian Aldi / 02PCT / 1601253441
Assignment By Mr. Tri Djoko Wahjono
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?
-the 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
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
1.What important part of support for inheritance is missing in java?
java does not support the private and protected derivation of c++.One can surmise that the Java designers believed that subclasses should be subtypes,
which they are not when private and protected derivations are supported. Thus,
they did not include them.
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.
10.explain one advantage of inheritance.
-The advantage is able to reuse the declared class in other name, an inheritance class will inherit all method , attribute inside the class without declaring the same class again. It also reduce the code length.
11.Compare inheritance and nested classes in C++. Which of these supports an is-a relationship?
-clearly inheritance that support is-a relationship. Inheritance offer a solution to both the modification problem posed by abstract data type can inherit the data and functionality of some existing type
nested classes are only used for data hiding, it does not inherit.