fork download
  1. type
  2. Rect = object
  3. x: float
  4. y: float
  5. width: float
  6. height: float
  7.  
  8. View = object
  9. frame: Rect
  10. bounds: Rect
  11.  
  12. Button = object of View
  13. clickEnabled: bool
  14.  
  15. proc initView[T=View](frame: Rect, obj: T=nil): T =
  16. if obj != null: result = obj
  17. result.frame = frame
  18.  
  19. proc initButton[T=Button](frame: Rect, clickEnabled: bool=true, obj: T=nil): T =
  20. result = initView(frame)
  21. result.clickEnabled = clickEnabled
  22.  
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.nim(15, 41) Error: type expected
stdout
Standard output is empty