Methods you cannot implicitly call in a copy constructor

Viewed 90

I was wondering if anyone could explain this question to me:

Given

class Fruit {...};
class Orange : public Fruit {....};

Which of the following methods are NEVER implicitly called at position XXX in the following code?

Orange::Orange(const Colour &colour) XXX {...}

A. Orange::Orange()

B. Default constructors for data member within class Orange

C. Fruit::Fruit()

D. Default constructors for data member within class fruit

E. A and C

F. A and D

The provided answer is F.

I was thinking that this is a copy constructor, and that class Orange is a child class and Fruit is a base class.

I wasn't sure why the answer would be A, and was thinking that the reason it is D is because Orange may have data members that Fruit doesn't have, therefore you cannot use it's default constructor.

Any help would be massively appreciated.

1 Answers
Related