Python Classes, Objects, Inheritance & Polymorphism for Beginners

  Рет қаралды 7,985

Dave Gray

Dave Gray

Күн бұрын

Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
Learn how to use Python classes, objects, inheritance, and polymorphism in this beginners tutorial. Classes are blueprints for creating objects. Classes can employ inheritance and create objects that demonstrate polymorphism.
💖 Support me on Patreon ➜ / davegray
⭐ Become a full-stack dev with Zero To Mastery Courses:
- The Complete Python Developer: bit.ly/CompPythonDev
- Complete Machine Learning & Data Science: bit.ly/CompMachineLearning
- Junior to Senior Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ bit.ly/3nGHmNn
📬 Course Updates ➜ courses.davegray.codes/
❓ Questions - Please post them to my Discord ➜ / discord
☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
👇 Follow Me On Social Media:
Github: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
🔗 Source Code: github.com/gitdagray/python-c...
🔗 Playlist for this Python Course: bit.ly/dg-beginners-python
Python Classes, Objects, Inheritance & Polymorphism for Beginners
(00:00) Intro
(00:05) Welcome
(00:16) What are Classes?
(00:35) A Simple Class Example
(02:06) Creating an Object
(03:10) _init_ and properties
(05:13) Creating a get method
(06:57) Create multiple objects from a class
(07:50) Class Inheritance
(12:25) Child Class _init_ and super()
(15:14) Polymorphism
(17:57) Review
📚 Tutorial References:
🔗 Python Official Site: www.python.org/
🔗 Visual Studio Code Official Site: code.visualstudio.com/
🔗 Python Module Index: docs.python.org/3/py-modindex...
🔗 Python Standard Library: docs.python.org/3/library/ind...
Was this Python tutorial about classes, objects, inheritance, and polymorphism helpful? If so, please share. Let me know your thoughts in the comments.
#python #classes #objects

Пікірлер: 15
@aravindhvijayanandan3010
@aravindhvijayanandan3010 9 ай бұрын
Amazing !!! Just began my journey into Python programming. Even though some these concepts flew over the head, really enjoyed your explanation. Like and subs from India !!!
@user-oc5dv5jc6i
@user-oc5dv5jc6i Жыл бұрын
Love your stuff as usual Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thanks!
@ShukyPersky
@ShukyPersky 6 ай бұрын
Thanks for the video. I have a comment on the polymorphism portion of the video. It is NOT polymorphism though it aligns with "many forms" meaning. The polymorphism demonstration in the video has nothing to do with polymorphism, It is purely typecast (and has to do with the fact that Python is weak-type/dynamic-type language) which means that the type of a variable is derived from the type of the value it refers to The below explains what you demonstrated: a = 7 # a refers an int type object a = 7.0 # a refers a float type object polymorphism means that a variable that refers an object of certain type can refer another type (like in C++ where a pointer to base class type can point to derived class type either). but this can not take place in Python, as the interpreter changes type of a variable according to the type of the data that variable refers to Due to the dynamic-type nature of Python, I'm afraid that Python has no polymorphism though so wrongly claimed
@deepatterson1894
@deepatterson1894 2 ай бұрын
I am still working through lessons, was stuck for a long time on the arcade lesson, which I think was really cool to test us on. I had to go back and make sure I really understood what I was doing. I made my own rps style, same code but did a lot more variations with fstring's and emojis. Though I did a lot of it correctly on the guess number game I was still blown away with differences in your code. I had to go back and try look at some of those lessons. I am very slow at this. I am not planning a career but a making a personalized app. I don't think it is going to be a very complex program but still have a lot of learning to do before I can start on that. Oh yah my arcade didn't work correctly because I had a return to game function where it should have just been return game_blabla without the (). I thought I was never going to find the problem. I want to say it was RPS code where the issue was, been a few days since I found the issue.
@manoharsagunthalla9215
@manoharsagunthalla9215 Ай бұрын
Your explanations are wonderful! when we inherit the class we add one parameter in the derived class(say faa_id in the Airplane class). but you have not explained how to display that added parameter when we invoke the model. will you please explain how to display that too.
@utinthein7274
@utinthein7274 Жыл бұрын
Thanks you, Sir.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You are most welcome
@abhaydhiman1920
@abhaydhiman1920 10 ай бұрын
A one shot or playlist of videos on Java Script will be great ....! Love From India
@Nihal0522
@Nihal0522 Жыл бұрын
3) Hi, Sir my question is how many topic you will cover in upcoming days? Or how many days it will take? Actually my exam is coming in upcoming next month.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
I cover one Python topic per week right now. There are likely at least 6 more videos in this series.
@johnaweiss
@johnaweiss 6 ай бұрын
Your getter would be more helpful if it `returned` something, rather than `print` something. Properties typically return something, and don't do something.
@tomjones8293
@tomjones8293 Жыл бұрын
Nice content and learner but Python does NOT have Polymorphism concept in OOP sense as we know it e.g like in Java using overloading , overriding methods because Python is DYNAMIC language . your "polymorphism" here is according to Cambridge dictionary not in programming sense :) hope this helps
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Many Python resources cover polymorphism. I'm doing the same here. It's not "my polymorphism".
@tomjones8293
@tomjones8293 Жыл бұрын
@@DaveGrayTeachesCode I see what you mean now I get it thanks
Python Exception Handling Tutorial for Beginners
12:16
Dave Gray
Рет қаралды 4,4 М.
OOP Class Inheritance and Private Class Members - Python for Beginners!
16:12
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 56 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 177 МЛН
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 10 МЛН
The Ultimate Guide to Writing Classes in Python
25:39
ArjanCodes
Рет қаралды 109 М.
Python Object Oriented Programming (OOP) - For Beginners
53:06
Tech With Tim
Рет қаралды 3,3 МЛН
Recursion for Python Beginners with Recursive Function Examples
17:54
Python File Handling for Beginners
22:40
Dave Gray
Рет қаралды 11 М.
Python staticmethod and classmethod
7:35
mCoding
Рет қаралды 113 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 919 М.
Python inheritance 👪
7:19
Bro Code
Рет қаралды 78 М.
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 56 МЛН