How about this: type Widget* = ref object of RootObj Layout* = ref object of Widget widgets*: seq[Widget] Button* = ref object of Widget proc newLayout(): Layout = result = new Layout result.widgets = @[] proc newButton(): Button = result = new Button proc addWidget(layout: Layout, widget: Widget) = layout.widgets.add widget let layout0 = newLayout() button0 = newButton() layout0.addWidget button0
- How to make covariance ? oom
- Re: How to make covariance ? boia01