I have got a work around. See this ; I just add a variable which contain the
whole base class.
type
BaseWindow = ref object of RootObj
title : string
width : int
height : int
windowCount : int
windowList : seq[int]
ChildWindow = object of BaseWindow
handle : int
parent : BaseWindow
Run
Now, i can easily access the base class members
proc NewChildWindow*(base : BaseWindow) : ChildWindow =
result.parent = base
result.parent.windowCount.inc()
result.parent.windowList.add(result.parent.windowCount)
echo "Created a Window"
echo "Title = ", base.title
echo "Width = ", base.width
echo "Height = ", base.height
Run
Now, i can easily access base members like this
var bw = NewBaseWindow()
var cw = NewChildWindow(bw)
echo cw.parent.windowList , " -- At Last i got it"
echo bw.windowList, " -- Same data"
Run
Is it a good practice ?