WRIGHT   STATE   UNIVERSITY
Department of Computer Science and Engineering
 
    CEG860 Winter 2007                    Final Exam (30 pts)                                     Prasad

NOTE: This is a Closed Book Exam. In your answers, be specific and to the point. Incorrect claims will be penalized.

1. OO Technology : UML (5 pts)
   
 What are the pros and the cons of a modeling language?  

2. OO Technology : Components (5 pts)
     What is a Web Service? Illustrate it with an example.

3. OO Technology : .NET (5 pts)
     How does .NET support multi-language programming? 

4. OO Technology : New Territory (5 pts)    
    What is Aspect-Oriented Programming? 

5. Single and Multiple Inheritance (6 + 4 pts)
 
    Explain clearly the constraints on the object layout and the method table layout to ensure code reuse (via inheritance) and dynamic binding (to accommodate polymorphism with overriding), while implementing an object-oriented programming language supporting single inheritance.  
      Explain clearly why this simple approach does not work for multiple inheritance.


6. Understanding Polymorphism and Dynamic Binding (10 pts)  

class Super {
    void print() {
        System.out.println( " \t Super.print().");
    }

    void rePrint() {
        print();
        System.out.println( " \t Super.rePrint().");
    }
}

class Sub_i extends Super {
    void print() {
        System.out.println( " \t Sub.print().");
    }
}


Carefully study the following attempted simulation of inheritance via composition and
delegation, and explain clearly the fundamental differences between the two versions of
Sub (Sub_i and Sub_d) that prevent their exchange. Justify your claim by writing
code fragments and tracing it.

class Sub_d {
      Super s = new Super();

      void print() {
         System.out.println( " \t Sub.print.");
      }
      void rePrint() {
         s.rePrint();
      }
}