Best practices for class instance variables as parameters

Ian ian at iangarcia.net
Sat Sep 28 18:16:55 UTC 2024


Hi,

I'm coming from C and some C++ so the way D stores class instance 
variables is new to me. If I'm not mistaken the basic unadorned 
instance variable is like a "hidden" pointer. So, when passing 
class instance variables to a function, what would be the point 
of passing a pointer or ref?

I think I answered myself, in that they'd would be pointers or 
references to the variable that holds the... hidden pointer to 
the class instance.

Now I'm unsure. When I pass a class instance to a function by 
value, I'm not creating a copy of the instance, am I?

Thanks,
  Ian


More information about the Digitalmars-d-learn mailing list