better alternative to 'override'
This commit is contained in:
parent
82f8948a10
commit
73add468b7
3 changed files with 18 additions and 19 deletions
|
|
@ -5,14 +5,14 @@ discard """
|
|||
|
||||
{.experimental.}
|
||||
|
||||
type
|
||||
type
|
||||
TMyObj = object
|
||||
x, y: int
|
||||
p: pointer
|
||||
|
||||
proc destroy(o: var TMyObj) {.override.} =
|
||||
|
||||
proc `=destroy`(o: var TMyObj) =
|
||||
if o.p != nil: dealloc o.p
|
||||
|
||||
|
||||
proc open: TMyObj =
|
||||
result = TMyObj(x: 1, y: 2, p: alloc(3))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue