+ 1
Shouldn't a parameter be a variable? How can an object be a parameter?
3 odpowiedzi
+ 6
You assign the object into a variable... ~_~ (also, who said that it cannot be an object?)
+ 3
the thing is that every variable is an object, an instance of a class. So then an object can be a parameter. For example an int variable is an object, an instance from the class Int. So your actually always using instance of classes.
+ 2
The data types such as an int, a double and the others are also objects.That's why each of them has their unique members and member functions that we usually use.So when passing a primitive data type, you might as well think of it as an object.
Thus, it is possible to pass an object as a parameter.