Yes, inheritance gives you what your parent type provides, there is no magical 
conversion. So it is not surprising. But your dynamic runtime type is ExtNode 
in your example, you can test with of keyword for it:
    
    
    type
      Node = ref object of RootObj
        children: seq[Node]
      
      ExtNode = ref object of Node
        ext: bool
    
    var
      n0 = ExtNode()
      n1 = ExtNode()
    
    n0.children.add(n1)
    
    echo n0.children[0][]
    
    if n0.children[0] of ExtNode:
      echo ExtNode(n0.children[0])[]
    
    
    Run
    
    
    $ ./t
    (children: ...)
    (ext: false, children: ...)
    
    
    Run

Reply via email to