Wednesday, June 26, 2013

Answers of Concepts of Programming Languages Chapter 12

Review Questions
1. CLOS, F#
2. Problems with programming with abstract data types are :

  • The modifications require changes to all client programs
  • the type definitions are all independent and are at the same level
3. Inheritance offers the reuse of the ADT and provides framework for the definition of hierarchies of related classes that can reflect the descendant relationships in the problem space
4. Message protocol is the entire collection of methods of an object
7. Dynamic dispatch is dynamic binding of messages to method definitions
8. The protocol of method in a class is called abstract method. Abstract class is the class that has at least one abstract method
9. Design issues for OOP are
  • The exclusivity of objects
  • Are subclasses subtypes?
  • Single and Multiple Inheritance
  • Allocation and Deallocation of Objects
  • Dynamic and Static Binding
  • Nested Classes
  • Initialization of Objects
11. Message protocol is the entire collection of methods of an object
12. All Smalltalk objects are allocated from the heap
14. The only type checking in Smalltalk is dynamic, and the only type error occurs when a message is sent to an object that has no matching method
15. Single inheritance
16. The Smalltalk user interface has had an important impact on computing : the integrated use of windows, mouse-pointing devices and pop-up and pull-down menus, and also the advancement of OO.
19. Heap-dynamic objects are deallocated using delete operator in C++
23. The public and protected members of a base class are also public and protected, respectively in public-derived class. In a private-derived class, both the public and protected member of the base class are private

Problem Set
1. Java does not support private and protected derivations like in C++
7. If a class attempts to implement two interfaces and both define methods that have the same name and protocol, there is no way to implement both in the class
9. class Base {
    public:
       void move()
       {
            cout<<"Move!";
        }
    };

    class Sub : public Base{
        void move()
        {
            cout<<"Fly!";
         }
    };

10. Inheritance offers the reuse of the ADT and provides framework for the definition of hierarchies of related classes that can reflect the descendant relationships in the problem space

No comments:

Post a Comment