Python - Object Oriented Programming | Polymorphism
ฝัง
- เผยแพร่เมื่อ 19 ก.ย. 2024
- Python Polymorphism and abstract classes
Python Object Oriented Programming, Python OOP concepts
What is Polymorphism in Python and how it is helpful
Full Python Beginner Playlist: goo.gl/UrcLw4
Become My Patron here goo.gl/NcvDQh
Angular Full 60 Minute Course goo.gl/TL2UFy
To Join Whatsapp, follow this link chat.whatsapp....
You can donate any amount via Paypal follow this link goo.gl/JhWsKC
Join Our Slack Community - goo.gl/pqCjZH
--You May Also Like --
Real-Time Chat Series - goo.gl/ri42FD
Git and Github series - goo.gl/BXyPxf
Blog with Admin panel Series - goo.gl/S5JGyt
Laravel Authentication Series: Multi Auth - goo.gl/TyCLlX
Vue Beginner To advanced Series - goo.gl/1bjdGg
Sublime Text Best Package Series - goo.gl/6phTPP
Laravel Ajax Todo Project - goo.gl/p2xTPW
Laravel 5.4 Full Beginner Playlist - goo.gl/zpKzhM
Laravel 5.3 Hindi Beginner Tutorials - goo.gl/Kb3ikd
==================FOLLOW ME ==================
Subscribe for New Releases!
Twitter - / bitfumes
Facebook - / bitfumes
Instagram - / bitfumes
(ask me questions!)
-- QUESTIONS? --
Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.
Email me support@bitfumes.com
Thanks for all your support!
It's "Ni Hao" not "Yeehaw" haha
XD
LOL
LMAO
so, peter griffin was right :P
Hey there, thanks for the video. I think it would be good to also point out what advantages polymorphism provides. In your example, it just adds more stuff to an already working piece of code ;-) But again, thank you for putting in the time to make this video. It is an easy-to-understand example of the "how" of polymorphism.
This is a great video , i learnt polymorphim and i almost forgot it , this video gave me a quick revision of polymorphism , thank you Sarthak sir
Thanks, the concept is clear.
It really helps !
When you say "ee-haw" so cute. Great vid :)
Thanks for trying but seems that any explanation I can find is incomplete or confusing. In this case you showed (if I am not wrong):
1)"polymorphism as "duck typing": you have two classes with no hereditary relationship amongst them, which simply have methods with exactly the same name.
2) "polymorphism as overriding": you have one class that inherits annother class (in your example class French inherits class Language ....and as second example class Chinese also inherits class Language), and the "son" class (the class that inherits annother class) has a method with the same name as the parent class (method "say_hello" ) and so it happens that the program will execute the method as defined in the son class, because it is more specific, which means that you can use one same method name ("say_hello") and obtain two different results depending on which code it runs: the code of the parent class or the code of the son class.
*According to books and videos about JAVA (don`t know if this is posible in Python too, but is useful to know) there is annother type of polymorphim called "method overloading" where you simply create two or more methods with the same name inside a class, but each of those methods has different types of parameters it can recieve, so depending on which type of parameters it recieves from the object that calls the method, one version of the method or annother different one will be executed.
Python does not support method overloading. The syntax don't. Methods with the same name under a class will only retain the last method definition. But they have something to make up for it such as manipulating Default Parameters and Keyword Arguments and Factory Functions (basically instantiating objects via function)
u r awesome. u make it so simple to use one example and it's works for Polymorphism, Inheritance , Abstraction.....He is expert, who can make critical things easy.
Is polymorphism the idea that you can have different children from the same parent class? Also, I really like the way you created the "abstract class" in the parent class without having to use the ABC module - just raise an error when it is called!
nice.. so easily expalined. thanks
Thanks a lot
Good explanation
Thanks from Argentina!
Bro super ah explain paninga...apdiya python hierarchical inheritance pathi video make panni poduga bro...
This is an important topic that
How to use Laravel with WordPress to customize our 3project and theme and develop own API.
It'll help for all Laravel and wp developers.
Plz make a video or article about it
sorry for the comment about it in here!
Thanks so much.
Sorry, bro I didn't use WordPress.
thanks
thanks 🙂
You're welcome!
Thanks for the video.... sorry, this is NOT polymorphism, this is about typecasting.
Polymorphism is a different mechanism and can't be implemented in Python due to Python's nature being dynamic-typed languge
Why they give such simple topics such complex names?
It’s not really complex, poly means many and morphism means having different form. These are suffix/prefix taught in middle or highschool depending on where you went.
‘Polygon’ - having many sides
‘Polysyllabic’ - many syllables
And more but yeah
Remember to always break down a word see if it has any familiar prefix or suffix, we tend to over look them and look at the word as whole a lot of times
gj . could you explain this in laravel eloquent ?
Hmmmm you are right. I will try to explain this on laravel level also
@@Bitfumes tnx dude
I was watching the video and all of a sudden my name appeared and I'm like waittt whattttttt😂😂
😵
did you liked it
This information is not correct completely.
hey, thanks for this, please tell me what else needs to implement
Hard to understand
Ni hao
lol yeehaw xD
no sense
This don’t make any sense bruh 😂
Fita mu
Don't drag and brag while talking. Speak normally
to better understand the use of it
class Language():
def speak(self):
print("Universal answer HELLO")
#raise NotImplementedError("Support but need to be implemented in child!")
class Portuguese(Language):
def speak(self):
print("oi")
class Spanish(Language):
pass #WE NEED MORE DEVELOPERS RIGHT NOW
def main():
print("started")
newLang = Portuguese()
newLang.speak()
moreLang = Spanish()
moreLang.speak()
if __name__ == "__main__":
main()