Forum > Beginners

Can Type be Redefined in Inherited Class?

(1/3) > >>

eoneuk:
In the following simple example, I want to redefine z so that in class c it is an integer, and in d, a real.  When I compile I get an error message "duplicate identifier z". 

Can this be accomplished, and if so, how?

Ed



--- Code: ---type
  c = class
 type
    z = integer;
  var
    x,y : z;
  end;

  d = class(c)
  type

    z = real;

 end  ;

--- End code ---

Blaazen:
Try to make it private.

eoneuk:
Thanks for your reply, but making it private had no effect.

Ed

marcov:
No, this is not possible.

Blaazen:
It is possible (with type defined in private section), but descendant class has to be in other unit.

Navigation

[0] Message Index

[#] Next page

Go to full version