20,741
edits
m (→A hash based version (recommended): :-)) |
mNo edit summary |
||
Line 450: | Line 450: | ||
You could even implement an overloaded function that creates arrays of objects. | You could even implement an overloaded function that creates arrays of objects. | ||
Now, let's imagine you want to add another member function to print a certain field's value, such as "number". This can be accomplished using the "me" keyword which ensures that the member function is always referring to the active object: | Now, let's imagine you want to add another member function to print a certain field's value, such as "number". | ||
Given that objects created from the same class template, there needs to be a way for a function to refer to itself, i.e. to refer to the object itself, otherwise the function wouldn't know what object is meant. | |||
This can be accomplished using the "me" keyword which ensures that the member function is always referring to the currently active object: | |||