Ricalsin
Ricalsin

Reputation: 940

OPP nomenclature question: object->function($param)

In OOP, what do call it when you do:

$o = new ClassInstance();

$o->someFunction($p);

For example, I would say I'm passing the parameter p to the function someFunction. Easy.

But how do you articulate the calling of a function in the class object, ClassInstance? You're not really passing the function someFunction to the object ClassInstance.... so would you say: "Call the someFunction function in the ClassInstance object?"

Thanks.

Upvotes: 0

Views: 107

Answers (1)

bfavaretto
bfavaretto

Reputation: 71918

"Call method someFunction from object $o (which is an instance of class ClassInstance), passing $p as an argument.".

Rephrasing for clarity:

$instance = new ClassName();
$instance->someMethod($p);

"Call method someMethod from object $instance (which is an instance of class ClassName), passing $p as a parameter (or argument)".

Upvotes: 1

Related Questions