[fpc-pascal] Re: Problem with virtual constructors

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Wed Jun 1 20:16:04 CEST 2011

Cobines solution worked !

not tested constref.

2011/6/1 Jorge Aldo G. de F. Junior <jagfj80 at gmail.com>:
> 2011/6/1 leledumbo <leledumbo_cool at yahoo.co.id>:
>> Yep, this situation would confuse the compiler as it's possible to assign
>> descendant class instance to a class.
>> 1st solution: rename one of the constructor, don't need to use
>> virtual/override
> Its a class factory, i cannot have multiple constructors, so i need
> virtual constructors in order to build classes from names.
>> 2nd solution: try using constref instead of const (I hope constref has the
>> same semantics as var for classes, where the assigned object must be exactly
>> the instance of expected class, descendants not allowed)
> I will try that.
>> --
>> View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Problem-with-virtual-constructors-tp4445729p4445832.html
>> Sent from the Free Pascal - General mailing list archive at Nabble.com.
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list