Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

I HAS-A Question

+5 votes
If is in a HAS-A relationship with B shouldn't one of them be a subclass of another? How do you identify the terminology of "If class A is in a HAS-A relationship with class B" because either on of those could be the subclass and the main object from my understanding.
asked Aug 30, 2017 in CSC 285 (F17) by Daniel Zwiener (100 points)

1 Answer

+4 votes
Best answer
Has-A relation ship does not refer to inheritance so neither A or B cam be a subclass, has a is a composition relation ship one object is part of another for example: A is a house and B is a bathroom, a house contains a bathroom.
answered Aug 30, 2017 by Samih Sghier (100 points)
selected Aug 30, 2017 by Daniel Zwiener