I have a copy constructor T::T(const T&)
. The object has two properties, let's say color
and height
. This means I need to assign the color and the height from the object in argument to my object. Problem is I don't know how to call the argument because it is not named.
If the argument is named, let's say t, code looks like this:
T::T(const T& t) {
color = t.color
height = t.height
}
But in my case there's no t argument. What should I replace the question mark ?
with in the following code:
T::T(const T&) {
color = ?.color
height = ?.height
}
Thanks for help!
Aucun commentaire:
Enregistrer un commentaire