Hi all, I have some code like this-
type
A* = ref object of RootObj
#properties ...
B* = ref object of A
# properties ...
FuncPtr* = proc(x : int, y : A) # A function pointer aka delegate
Person* = ref object
fnPtrList* : seq[FuncPtr] # this list will init later
# props ...
proc setFuncPtr(me : Person, pfnPtr : FuncPtr) = # this proc will fetch
the list
me.fnPtrList.add(pfnPtr)
Run
Now, i want to create the person object
proc sampleProc(p : int, q : B) # Here i am using B instead of A. Because i
need it
var p = new Person
p.setFuncPtr(sampleProc) # This line is showing error. Compiler says it is
expecting type "A" instead of B.
Run