[comp.lang.eiffel] generic inheritence bug

marcap@concour.CS.Concordia.CA (Marc Pawlowsky) (10/08/89)

I believe I have found a bug in the inheritance system of Eiffel 2.1.
I am working on s Sun 3/50 under Unix 3.5 (export).

The bug(?) is that in the code segment below, the features in C use the features
declared in D and not E, even though type P is of class E (which inherits
from class D).

class C[P->D]

export
  out

inherit 
  STD_FILES

feature


  variable: P;

  out is
    do
      variable.out(output);
    end; -- out


  Create is
    do
      variable.Create;
    end; 

end  -- C  


class D

export
  out

inherit 
  STD_FILES

feature

  Create is
    do
      output.putstring("Creating class D\n");
    end;


  out(f:FILE) is
    do
      f.putstring("out class D\n");
    end; -- out

end -- class D 



class E 

export
  out

inherit
  D redefine out

feature

  Create is
    do
      output.putstring("Creating class E\n");
    end;


  out(f:FILE) is
    do
      f.putstring("out class E\n");
    end; -- out

end -- class E 



class  F

feature

  v: C[E];

  Create is
    do
      v.Create;
      v.out;
    end;

end -- class F

The root is class F and the output is

Creating class D`
Out class D