Тёмный

Polymorphism in Kotlin with Example | Kotlin For Beginners CheezyCode #20 

Cheezy Code
Подписаться 73 тыс.
Просмотров 29 тыс.
50% 1

Опубликовано:

 

28 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@RaajKanchan
@RaajKanchan 3 года назад
The best video tutorial to understand Polymorphism. Simply Awesome 👌👌👌
@anmolverma075
@anmolverma075 Год назад
Sir ,really a great explanation! Jaise aap smjhate ho ,blkl next level hai!
@snooringcode6594
@snooringcode6594 4 года назад
Videos like this really deserve a like. Make a video on interface and how it is beneficial in multiple inheritance.
@CheezyCode
@CheezyCode 4 года назад
Sure brother in progress
@chndraja
@chndraja 2 года назад
Type inference was amazing... Thank you for this amazing video....
@riteshmukhopadhyay6922
@riteshmukhopadhyay6922 3 года назад
It was hard to grasp in the beginning but after reading few articles and again watching your video, run time polymorphism is crystal clear. And you had already explained compile-time polymorphism that technique is function overloading, right? Thanks, Cheezy guy👏🙌
@CheezyCode
@CheezyCode 3 года назад
Polymorphism ka actual meaning dynamism se hai...but kaafi books overloading ko compile time polymorphism btati hai...toh consider kar skte ho...but crux yehi hai ki code future ready hojata hai if we use it correctly
@riteshmukhopadhyay6922
@riteshmukhopadhyay6922 3 года назад
@@CheezyCode ooh ye nhi malum tha, thanks for the info 😁👍
@CheezyCode
@CheezyCode 2 года назад
Dynamic method dispatch is a way of implementation of polymorphism in Java or Kotlin....
@TheAbhidugar
@TheAbhidugar 3 года назад
4:58 agar child classes me new methods add hote hai aur unhe access karne ke liye naya object banana padega? like: val circle = Circle(). btw aapki saari videos me dekh raha hu kotlin ki. isse badhiya explanation kahin nahi hai. aapne har point ko explain kia hai. Polymorphism ka advantage aaj pura clear ho gaya jabki me java ab kuch se kar bhi raha tha. par ab saat janmon tak yaad rahega. thank you cheezy bhaiya.
@CheezyCode
@CheezyCode 3 года назад
Thank you Abhishek. Yes in that case reference should be of type circle then only you will be able to call new methods of circle. Aur comment ne dil khush kardiya....😁abstract aur interface aur jyada majja aayega... Insta pe short notes bhi hai...Ho ske toh please share these videos...
@TheAbhidugar
@TheAbhidugar 3 года назад
@@CheezyCode hanji bas aaj kotlin puri kar leni fir Android shuru karna
@rohittakalkar9252
@rohittakalkar9252 5 месяцев назад
[Important to understand]: Only overridden methods/properties in the child class are accessible through a reference to the parent class pointing to an instance of the child class, but other properties or methods specific to the child class won't be directly accessible through that reference And this is the reason why overriding is taught before polymorphism.
@ManishKumar-eh4ol
@ManishKumar-eh4ol 3 года назад
Best lectures on kotlin
@CheezyCode
@CheezyCode 3 года назад
Thank you 🤘
@shahriarsharif6736
@shahriarsharif6736 3 года назад
Thank you from Bangladesh. Please add English subtitle.
@naimeimran3247
@naimeimran3247 3 года назад
Thanks Sir
@amanjotkaur3964
@amanjotkaur3964 2 года назад
Usefull vedio don't miss
@CheezyCode
@CheezyCode 2 года назад
Thanks Daman
@kaushikpaul6583
@kaushikpaul6583 3 года назад
Hii, here circle and shape are the base class reference, holding the memory of Circle & Square class objects respectively. But later u have created array of objects of three different classes which are passed to the calculateArea() and then individual objects stored as array elements are called and it is obvious that it will call its own memory locations. Then there is no use of the first two lines written in main()?? I can omit that...right?? Please guide
@CheezyCode
@CheezyCode 3 года назад
Yes...no need of those 2 lines then.... Main point of this video - in calculate areas method you can pass object of any class that inherits from shape class. Whether you have that in your project currently or a new class will be added in future. Body of that method will remain unchanged.
@cheems08213
@cheems08213 Год назад
sir im confused, i think polymorphism is function overloading and overriding, what you have explained in the video is upcasting
@CheezyCode
@CheezyCode Год назад
Overriding ka benefit kya h?... Object hold kar rahe ho parent object mei but uske andar child ka object bhi ho skta hai. Runtime pe decide hota h ki actually mei parent ka reference kis object ko hold kar rha h...jis bhi child object ko hold kar rha hoga uska method call kar diya jata hai...this is polymorphism. This is not upcasting. This is how polymorphism works i.e. at runtime it is decided to call the method based on the type of the object. Upcasting is simply holding a child object inside parent reference. For e.g. in Java - I can do this Object o = any object This is upcasting because Object is the parent class of all the objects. I can safely store any object using parent's reference. Let me know if you need more clarity. Or you can refer good sources like Head First for more information. I have read Head First Java thrice to clear these OOPs concept.
@cheems08213
@cheems08213 Год назад
@@CheezyCode ok sir thank you for replying, ill definitely read more on this topic
@wasimakrambiswas4216
@wasimakrambiswas4216 3 года назад
I am new in kotlin .I might be wrong . but In General term it is not satisfying rules of POLYMORPHISM . it is satisfying concept about " CASTING " ...
@CheezyCode
@CheezyCode 3 года назад
Let's discuss 🙂
@CheezyCode
@CheezyCode 3 года назад
Waise ye crux hai iska - jab thoda code likhoge toh clear hojayega ..it is same as any other programming language. I have explained the advantage we get by writing polymorphic code..
@wasimakrambiswas4216
@wasimakrambiswas4216 3 года назад
Okk ... Thank you ... 🙂
@ksujalpatel
@ksujalpatel 2 года назад
Examples maybe made more easier to understand
@CheezyCode
@CheezyCode 2 года назад
Examples are based on continuation...I am assuming you have watched previous videos as well...just for OOPs concept...if you start from classes and objects video - it will make more sense...
@ksujalpatel
@ksujalpatel 2 года назад
@@CheezyCode you done really Good Job, i appreciated Thanks you !
@tuananhtran7518
@tuananhtran7518 Год назад
please turn on subtitles :(
@fitnessbrandspormotion
@fitnessbrandspormotion Год назад
4:58
@nikhilmandlik355
@nikhilmandlik355 3 года назад
It's Upcasting
@CheezyCode
@CheezyCode 3 года назад
No it's not...
@CheezyCode
@CheezyCode 3 года назад
Watch its other part too - you will be able to understand the real polymorphism...I have explained the crux of this...things will make sense when you will write more code using this approach
@ronitrojasara
@ronitrojasara 2 года назад
hey! search on the internet it is not polymorphism
@CheezyCode
@CheezyCode 2 года назад
Ok
@CheezyCode
@CheezyCode 2 года назад
Please provide the links as well for more information.... Thanks
@CheezyCode
@CheezyCode 2 года назад
Ek info meri taraf se - keywords ka koi mol nahi h....concepts clear hone chaiye
@007ayansinha
@007ayansinha 4 года назад
isko polymorphism nai upcasting kehte hai 🙄
@jatinvashisht4293
@jatinvashisht4293 3 года назад
Clear your basics bro !
@007ayansinha
@007ayansinha 3 года назад
@@jatinvashisht4293 How well versed are you in Object-oriented? please watch 3:10 again and it will clear your doubt. Anyway its ok to live like as an ok, if even if you don't make it further.
@CheezyCode
@CheezyCode 3 года назад
It's ok guys...let it be....I have created this video based on my knowledge for over 11 years. Just appreciate the whole concept whether it's upcasting or polymorphism. But just to be clear - watch the whole video - polymorphism is only possible if we have upcasting. I have written 2 points for the complete definition. 1st point is upcasting and other one is just using that concept. Both points are required. Cheers from CheezyCode 🤘
@007ayansinha
@007ayansinha 3 года назад
@@CheezyCode appreciated for clarification, anyway watched all your videos on Kotlin. Really helpful. Looking more :-)