What type of relationship exist between classes?

What type of relationship exist between classes?

1 Like

Such relationship can be termed as “aggregation” relationship between classes. It is also called as “has a” relationship

Object oriented programming is as the name suggests a programming language which considers everything in the form of an ‘Object’.

But where do objects come from? How are they created? That’s from a ‘Class’.

For example, you want to explain the behavior of a Pen, you write a ‘Class’ for Pen and give some properties(like color, type etc) and define its behavior (like how it writes etc) using methods.

Now you can create as many pen 'Object’s as you want and use them to print in console or whatever you want to do.

As many concluded; a Class is a blueprint and object is an instance of it which can be used.