Class/Interface/Contract -- Re: fake class in OE

new topic     » goto parent     » topic index » view thread      » older message » newer message
mitgedanken said...

But I prefer

class_pointer goat_ = class:new("Goat") 
method_return goat_name = class:method(goat_, "get_name", {}) 
-- or class:call(...) 
-- or class:func(..) / class:proc(...) 

Erm, this currently/already works in Phix

class Goat 
    string name 
    function get_name() 
        return name 
    end function 
end class 
 
Goat goat = new({"Gertrude"}) 
?goat.get_name() 

Note that goat.name works the same as goat.get_name() here, because it recognises the "get_" part.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu