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!
As @some-programmer-dude mentioned, I was confused about the difference between function declarations and definitions.
My declaration was T::T(const T&)
but that didn't stop me from defining an argument t in my definition T::T(const T& t)
.
Thanks!