Question 15
Back to Exercise
What relationship does class Stack : private std::vector<int> express?
- A Stack IS-A vector
- B "Implemented in terms of": Stack reuses vector's implementation but hides its interface Correct
- C vector IS-A Stack
- D Stack HAS-MANY vectors
Correct Answer: Option B
Outside code cannot treat a Stack as a vector or call insert on it; using-declarations can re-expose chosen members. A private member is usually simpler.
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!