I have not used OOP in Nim so far. I was playing with the following code:
    
    
    type
      Coord = ref object of RootObj
        x,y,z:float
      
      Pt* = ref object of Coord
      
      Tmp = ref object of RootObj
        tag:int
        point:ref Pt
    
    
    let a =  Pt(x:1.0, y:3.0,z:2.0)
    
    let d = Tmp(tag: 4, point: a )    #<<<< This is what I am interested in
    echo repr d
    
    Run

where I got:
    
    
    /tmp/ex01.nim(14, 26) Error: type mismatch: got <Pt> but expected 'ref Pt'

How do I pass a reference?

Reply via email to