{
  ex1.s

  Contents:

     1. a normal class A
     2. a reflective(shell) class B
     3. a shell class C whose allowed set contains A and B

  Tests:
    1. the attachment of C shells to objects of A and B;
    2. the access to shell instance variables when the class of the
       object the shell is attached to belongs to
          - a normal class like A;
          - a reflective(shell) class like B;
    3. message sends to "object" in shell classes.

  }

class A
  private:
    var i :  integer;
  public:
   proc get() : integer
     begin
     write(100);
     return i;
     end
   proc put( NewI : integer )
     begin
     i = NewI;
     write(200);
     end
endclass


reflective(shell) class B
  private:
    var i :  integer;
  public:
   proc get() : integer
     begin
     write(100);
     return i;
     end
   proc put( NewI : integer )
     begin
     i = NewI;
     write(200);
     end
endclass



shell class C(A)  B
  private:
    var k : integer;
  public:
    proc put( newI : integer )
      begin
      object.put(newI);
      write(newI);
      k = 2*newI;
      write(k);
      end
endclass



class Program
  public:
    proc run()
        var a : A;
            b : B;
      begin
      a = A.new();
      a.put(4);
      if Reflect.attachShell(a, C.new()) == 0
      then
        a.put(5);
        if Reflect.removeShell(a) == 0
        then
          a.put(5);
        endif
      endif
      b = B.new();
      b.put(1);
      if Reflect.attachShell(b, C.new()) == 0
      then
        b.put(2);
        if Reflect.removeShell(b) == 0
        then
          b.put(3);
        endif
      endif
      end
endclass


