2013/9/30 Sven Barth <pascaldra...@googlemail.com> > > However, this does not work, because it seems that I cannot make any >> generic method virtual! In TIntTree, I have to write: >> >> function TIntTree.DoClone: TIntTree; >> >> As it is not possible to write TTree outside of the generic definition. >> > > This should do it:
Right, this worked. My last question for this issue: is the TSelfType a 2.6.2 workaround, or it is required even in 2.7.1? I mean, how about this: === code === type generic TTree = class protected procedure DoClone(aNode: TTree); virtual; //<<-- instead of TSelfType end; TIntTree = class(specialize TTree<Integer) protected procedure DoClone(aNode: TTree); override; //<<-- instead of TSelfType end; === end code === In another word, use "TTree" to represent any of its specialization and their descendants. Is it possible in 2.7.1 or later? Thanks a lot. Xiangrong
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal