This commit is contained in:
Araq 2013-05-04 13:21:36 +02:00
commit af441e607f
4 changed files with 35 additions and 7 deletions

View file

@ -0,0 +1,20 @@
type
TAnimal=object {.inheritable.}
PAnimal=ref TAnimal
TDog=object of TAnimal
PDog=ref TDog
TCat=object of TAnimal
PCat=ref TCat
TAnimalArray=array[0..2,PAnimal]
proc newDog():PDog = new(result)
proc newCat():PCat = new(result)
proc test(a:openarray[PAnimal])=
echo("dummy")
#test(newDog(),newCat()) #does not work
var myarray:TAnimalArray=[newDog(),newCat(),newDog()] #does not work
#var myarray2:TAnimalArray=[newDog(),newDog(),newDog()] #does not work either