T
Tony Johansson
Hello Experts!
I have this constructor for class Flight.
Flight::Flight(string flight_no, Klocka dep_t, Klocka arr_t)
: no(flight_no), dep(dep_t), arr(arr_t) {}
Both dep and arr are objects of the Klocka class in the definition of the
Flight class.
The call to instansiate a Flight object is.
Flight f3("AA7089", ka, kb);
In this constructor for class Flight I wonder how many times will the copy
constructor for class Klocka be called.
As I have learned you may correct me if I'm wrong when an actual argument is
passed by value to a function will the copy constructor be called. In this
case will the copy constructor for class Klocka be called for copy object
ka to object dep_t and copy object kb to object arr_t.
But now to my question will the copy constructor for class Klocka be called
also for copying object dep_t to object dep and copying object arr_t to
object arr in the initialize list?
Many thank!
I have this constructor for class Flight.
Flight::Flight(string flight_no, Klocka dep_t, Klocka arr_t)
: no(flight_no), dep(dep_t), arr(arr_t) {}
Both dep and arr are objects of the Klocka class in the definition of the
Flight class.
The call to instansiate a Flight object is.
Flight f3("AA7089", ka, kb);
In this constructor for class Flight I wonder how many times will the copy
constructor for class Klocka be called.
As I have learned you may correct me if I'm wrong when an actual argument is
passed by value to a function will the copy constructor be called. In this
case will the copy constructor for class Klocka be called for copy object
ka to object dep_t and copy object kb to object arr_t.
But now to my question will the copy constructor for class Klocka be called
also for copying object dep_t to object dep and copying object arr_t to
object arr in the initialize list?
Many thank!