Re: howto dispatch to derived classes?

2013-10-14 Thread Manfred Nowak
=?UTF-8?B?QWxpIMOHZWhyZWxp?= wrote: > a virtual function like accept() can do the trick This would require changes in the whole class hierarchy. But because of > The actual type of the object is implicitly stored in the > vtbl of each type. and in addition, because the statement | writeln( getC.

Re: howto dispatch to derived classes?

2013-10-14 Thread Ali Çehreli
On 10/14/2013 02:09 PM, Manfred Nowak wrote: >> class C{} >>class C1:C{} >>// ... >>class Cn:C{} >> >> C getC(){ return new Cn;} // might be extern >>// and deliver some Ci >> >> void visit( C1 fp){} >> // ... >> void visit( Cn fp){} >> void main(){ >>v

howto dispatch to derived classes?

2013-10-14 Thread Manfred Nowak
> class C{} > class C1:C{} > // ... > class Cn:C{} > > C getC(){ return new Cn;} // might be extern > // and deliver some Ci > > void visit( C1 fp){} > // ... > void visit( Cn fp){} > void main(){ > visit( getC); // dispatch? > } -manfred