Python OOP Tutorials | Composition and Aggregation

preview_player
Показать описание
In this Python Tutorial for Beginners video I am going to show How to use Class Composition in Python. Composition allows us to delegate some responsibility from one class to another class.
In Class Composition one class acts like a Container and other acts like a content. Composition represents "part-of" relationship.When there is a composition between two Python classes , the content object cannot exist without the container object.

In this Python Tutorial for Beginners video I am going to show How to use Class Aggregation in Python. Also I am going to give the Difference between Aggregation and Composition with a python example.Aggregation represents Has-A relationship.
Aggregation has a unidirectional association i.e. a one way relationship between associated classes.In Aggregation, both the associate class objects can survive individually.

#PythonTutorialforBeginners #ProgrammingKnowledge #LearnPython #PythonCourse #Python #Python3
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

I dont know who you are, but I hope you're doing well.
This is the best beginner friendly explanation I've seen BY FAR and you're a real lifesaver.
THANK YOU!!

Christina__V
Автор

Man, you are so criminally underrated. This is not fair. Your video was very good.

ReighKnight
Автор

Great job. Using "has a" and "part of" as a way to reinforce the descriptions of the two different relationships was brilliant.

rantalbott
Автор

Thank you for everything, I'm not an expert in English but I understood every word you said, you´re terrific. Greetings from Mexico.

luispacheco
Автор

I’ve got an exam soon and this really clarified the differences. Thanks

Playmade-
Автор

Very helpful. Thank you. Repeatedly going back and forth in your descriptions helped a lot

gavdownes
Автор

Genuinely very helpful video and your way of teaching are superb. You really make me easy to understand. Thanks

qaisereyes
Автор

Thank you for this practicaly explanation. I understood composition and agregation before, but you explained it here so detailed - I never thought about the three diffrent charakteristics of them.

alexl
Автор

Superb Sir... grt8
crystal clear explaination....I want more videos on Python Advanced concept

shamiqureshi
Автор

Thank You So Much Sir. It is a great explanation.

ArhamKhan
Автор

simply and wonderful explanation thank yoy

BoubakerElbikam
Автор

Thank you for making this video, great explanation and applications of the concepts!

azzamjoy
Автор

thank you so much, this is literally good video!

linlinli
Автор

What if we would like access pay through Employee class? how to do it?

Garczek
Автор

Please note that I followed the same example code and I am getting an error under the total_salary method, and trying to call annual_salary method implemented under the Salary class The exact line is return self.obj_salary.annual_salary(), its expecting a parameter, Its either something changed with latest python release or something.

mouse over is displaying a hint : Parameter 'self' unfilled

leopoje
Автор

man I'm confused between composition and dependency, I know they are represented in different ways in UML with different pointers.

dmqinbl
Автор

Please anyone answer this ...
In the above example in aggregation ...inside employee constructor ..instead of writing
self.obj_salary =salary
Can we write
self.salary =salary?

nandinirm
Автор

there is a semicolon in aggregation line 13 but still the code working????

AayushSharma-swtt
Автор

8:13
watch out 👀 *has.a* is Composition, not Aggregation. has.a if you think about it is like part.of
edit: I am not sure anymore

FranEnchufes