Question 6
Back to Exercise
Truck derives publicly from Vehicle, which has a protected member fuel_. Inside a Truck member function, which access is allowed?
- A v.fuel_ where v is a Vehicle&
- B other.fuel_ where other is a Truck& (and this->fuel_) Correct
- C Both
- D Neither
Correct Answer: Option B
Protected members may be accessed only through the derived class's own type; otherwise any class could derive from Vehicle just to modify every Vehicle.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!