Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following class specification: a. Suppose class B publicly inherits fr

ID: 3797398 • Letter: G

Question

Given the following class specification: a. Suppose class B publicly inherits from class A. What will class B inherit from a? b. Suppose class B privately inherits from class A. What will class B inherit from A? class A {public: void f(); int %(); int gatz(); protected: void h(int); int k(int); int y; private: void fp(); int z;}; Indicate whether the relationship between the classes is composition or inheritance? a. shape, Right Triangle, and Polygon b. and Card c. Employee and Human d. word Counter (Assignment 2) and vector e. Vampire and Fang

Explanation / Answer

8.
a) class B : public A
# class A all public variables & method remain public and gets inherited
# class A all protected variables & method remains protected and gets inherited
# class A all private variables & method doesn't get inherited.

b) class B : private A
# class A all public variables & method gets inherited and converts to private
# class A all protected variables & method gets inherited and converts to private
# class A all private variables & method doesn't get inherited.

9.
a. Shape => Polygon => RightTriangle = Inheritance.
b. DeckofCards, Card = Composition
c. Employee inherits Human = Inheritance
d. WordCounter(Assignment 2) and vector = Composition.
e Vampire and Fang = Composition

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote