22.2. Implicit arguments

Suppose that SomeClass is a class whose prototype includes a member _val and two functions SomeFunction and SomeOtherFunction.

class SomeClass 
{ 
    int _val; 
    int ValSquared(){return _val * _val;} 
    int SomeFunction(int input); 
    int SomeOtherFunction(int first, int second); 
}; 

Now if K is an object of type SomeClass, then the value of, let us say, K.SomeFunction(17)will depend on (a) the argument 17, (b) the function definition of SomeFunction, and (c) the contents of the object K. K is an ‘implicit argument’ to this function call.

When you write out the code for SomeFunction, you play on the fact that you have an implicit argument to the function, even though you don’t explicitly show it. Thus the code for SomeFunction

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.