The

COMPOSITION

Relationship

What is Composition? For example

Lets say you were modeling a classroom. Now every classroom needs a teacher. However to model the teacher in the classrooms constuctor method is too rigid. So we make an instance variable before the constuctor method to represent the teacher, and since it's an instance variable it can be used thoughout the classroom class. Then in the Classrooms constuctor we assign a new teacher to this variable.