Python Programming Tutorial – 29 – Classes and Objects

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

Nirmal KC says:

For the people that doesn’t understand the self
Since I have some coding experience in c++ I think I understand how the ‘self’ argument works. The ‘self’ argument is kind of same as ‘this’ pointer. The main purpose of ‘this’ pointer was it point to object that it calls and that’s what self argument is doing. Let me give u an example.
class Num:
num = 5
def print_num(self, num):
print(self.num) # prints the num of the class Num
print(num) # prints the num that you have passed in the function

x1 = Num()
x1.print_num(100)

Output:
5
100

I believe this self argument is mainly used to clear idea of which variable u want to use i.e. variable of the class or just the argument which has the same name as the class variable.
Hopefully this helps and sorry for my bad English

Joe Pannu says:

best online university in the world! thenewboston UC

Ishika Soni says:

can u descriptively tell what is “self”???

Hitesh Sharma says:

In line 15 enemy1 = Enemy() , So why parenthesis its a class right ? doesnt it comes with a function ?

Nehemiah Valerio says:

Bucky, how did you disable the spell checker (squiggly underline) in your Pycharm

Erik Ek says:

I’ve seen all kind of explanations of objects and classes, all the way back to 1995 when I first attended my first class in Java. This is by far the best and cleanest explanation I have ever seen. I’ve seen so many teachers and professors struggling for days and weeks to make their students understand. And I do believe you unfolded this enigma in less than 8 minutes. You sir deserve a standing ovation…

CrazyCottageCheese says:

I had a problem wrapping my mind around classes until I watched this. Great job!

Elliott Johnson says:

Understood most of it. Didn’t quite get my head around “self”

Proud to Be a Gamer says:

Who is watching this in 2017

Rachana Aithal says:

when i type the code you hv explained i get an error tellin that 1 argument is expected but none is given

Elise Ching says:

Hi just wanted to say you are the best teacher ever!!!my school’s teacher doesnt teach anything at all! THANK YOU SO MUCH FOR THESE AMAZING VIDEOS

prog man says:

Thanks matr

Tipsy River says:

I got really carried away on this one, but adding all the extra stuff(life, armor, offence, defence, dodge and critical strike chance) to the game was super fun.
I made the player OP(enemy has no armor at all his stats are a bit lower), but he still loses a lot since the attack turns are random and the enemy can get a lucky dodge or crit.

Dragon377 says:

AWESOME! Just got into class and object and this tutorial helped so much! Thank you very much!:)

Marcin Migacz says:

Bucky ! that is the best explanation how class work ! Easy, simple straight to my brain ! Thank You !

John Harper says:

Amazing tutorial – this is the fifth one I’ve listened to and now it’s finally starting to make sense. Great job!

Warren Crasta says:

In terms of object-oriented design, having attack() in the Enemy class doesn’t make much sense, because an enemy shouldn’t attack himself. It would make more sense to put attack() in a Character class. Is this correct?

Kristian Katin says:

you make the best tutorial vids man. Learned alot from your vid in the best two months compared to other tutorials. keep up the good work bucky!

Lectriss says:

THX!!!!

E R says:

Create an object first to access all the functions in a class.

Each object is really a ‘copy’ of its class, so changing the object does not affect the class itself.

Husam Alsairi says:

Thank you so muck Bucky..

Mike H. says:

New to OOP. Question: enemy1 for example is an instance of Enemy, right? Because he is always saying enemy1 is an object. Which is also true, but instance of Enemy would be more precise, right?

Otherwise, this is just an awesome explanation of OOP. Not that ‘stupid’ abstract non-related coding stuff you find on the web. 😉

Bob Jackson says:

You really helped me thx alot

Winston Loke says:

Better than my school tutorials.

ahervert says:

Very nice explanation !!!!thx

dayanj says:

very helpful! thanks a lot

Jogga Jasus says:

you are awesome bucky

Ibrahem says:

great explanation !

Malte Zätterström says:

Really Good Video!!!!!!!!!

Feed Brain says:

Please, tell me the relation between REST API and Python.

archit jen says:

Was having a hard time getting to know this. You made it look like a piece of cake. Thanks Bucky

Steve Fox says:

Great explanation!

Percy Guo says:

This video really helps me to understand the concept of ‘class’ and ‘objects’ in Python

Prototype gamer says:

Thanks for this video, I got many things from this video. Keep the good word upp dude.

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours