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

I HAS-A Question

+2 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 in CSC 285 (F17) by Daniel Zwiener (3,504 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 by Samih Sghier (660 points)
selected Aug 30 by Daniel Zwiener