Which of the following must exist to inherit attributes from a particular class?
A.
Public properties
B.
A has-a relationship
C.
Static members
D.
An is-a relationship
Explanation:
Visual Basic has been a pioneer of binary code reuse — controls being the classic example.
You reuse the code in a control by placing an instance of the control on your form. This is
known as a containment relationship or a has-arelationship; that is, the form contains or has
a CommandButton.
What does the explanation explain? The question is about inheritance and is-a relationship but not about containment and has-a relationship.
Agreed, completely unrelated. I’ve noticed that this occurs periodically on this site.
I would say Public Properties.
To me, Is-A and Has-A are design patterns not requirements. ie: you cannot inherit if base class does not have public members, irrespective if there is a has-a or is-a relationship between thew two classes.