Hello all, new here. Nim interests me a lot and I am experimenting with it 
currently but have hit a road block that I haven't found any documentation or 
forum posts about.

How would I create a base "class" method that I can access from instances of 
derived "classes"?

Set up my "classes"
    
    
    # base class
    type Tool = ref object of RootObj
    ...
    
    # My base "class" method
    proc toolMethod(t: Tool, int param) {.base.} =
    ...
    
    # derived class 1
    type Hammer = ref object of Tool
    ...
    
    # derived class 2
    type Gun = ref object of Tool
    ...
    

Create some instances of derived "classes"
    
    
    var hammer: Hammer = ()
    var gun: Gun = ()
    

Now, I want to access the base method... 
    
    
    gun.baseMethod(5)
    hammer.baseMehod(2)
    

So, what would be a good way to achieve this?

Reply via email to