Re: pass by ref

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

I did change a small bit of your dude Class like code. Check it out! :)

dude_pseudo.ex with type checking

Looks good. I would make a few more changes:

  • make the Dude type public so you can use it elsewhere
  • allow the Dude type to accept NULL for empty objects
  • update your main() routine to use the Dude type
constant NULL = 0 
 
-- Awesome Euphoria Feature!  Let's define what a dude looks like. 
public type Dude (atom ptr) 
    return equal(ptr, NULL) or equal(eumem:ram_space[ptr][__TYPE__], DUDE_ID) 
end type 
 
procedure main() 
     
    Dude my_dude = dude:new( "John", "Smith", 32 ) 
     
    display( "[] [] is []", { 
        get_fname( my_dude ), 
        get_lname( my_dude ), 
        get_age( my_dude ) 
    } ) 
     
    maybe_any_key() 
     
end procedure 

-Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu