You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type X =objectofRootObjtype Y[T] =objectof X
op*: T
type Z =objectof X
op*: intprocnewY[T](op: T): ref Y[T] =new(result)
result.op = op
procnewZ(op: int): ref Z =new(result)
result.op = op
procy(): ref X =newY(6)
procz(): ref X =newZ(5)
methoddesc(i: ref X): string=quit"Must override"methoddesc[T](i: ref Y[T]): string=$i.op
methoddesc(i: ref Z): string=$i.op
let i1 =z()
let i2 =y()
echo i1.desc() # prints "5"echo i2.desc() # exits with "Must override", should print "6"
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: