We need to take a break from applying the big three steps and fix the copy constructor.
So far, we fixed the constructor and we added a geter, the next step should be data center, but there's
something missing in the copy constructor.
So in this lesson, we're going to fix it.
The copy constructor is missing a field update.
We certainly stand to equal to a new object and passed in Nissan as an argument jarvis's the argument
and Nossiter on the copy constructor.
The parameter source story is a reference that points to the Nissan object, this refers to the current
object, the one that's calling the constructor and the copy constructor copies every field from the
source object into the current object.
But wait, it doesn't copy the parts away from the source so that field stays null.
All right, using a raised copy of we're going to set the parts field of the current object being created.
Equal to a copy of the.
Parts away from the source object.
And we're going to copy the full length of the array.
And they're now everything should work, you run your code and test it.
And it works as expected, Nissan 2s parts field, is it not anymore?
The copy constructor copies every value from the source object into the current object.
And now I'm fully confident that every object defines fields and all of these fields have been provided
a value one way or another and finally noticed that both constructors are identical in the first constructor,
we're using parameters to update each field and in the second one, we're updating each field from another
object.
The differences are very minor.
In this lesson, you fixed the copy constructor, each car object has Fifield's, but the copy constructor
was only updating four of them, so we added the extra field updates.