• entries
    98
  • comments
    26
  • views
    77,837

object oriented programming

Sign in to follow this  
Followers 0
xKLAATUx

245 views

this is my noob understanding of the concept, taken from a friend-of-a-friend's explanation of it (whose name I have forgotten so cannot credit, so I will change it enough to make it appropriately non-plagiarist but close enough to still be accurate)object oriented programming is a user-friendly way of grouping data together so that it's easier for the programmer to work with.So instead of making a list of all your data:

objList = [(fast, sleek), (slow, ugly)]obj1_speed = objList[0][0]obj1_design = objList[0][1]obj2_speed = objList[1][0]obj2_design = objList[1][1]

and then getting the data:

print obj1_speed> fast

you instead make a CLASS. This is a template of the data structure you want to use:

class coolObject():def __init__(car):car.speed = ""car.design = ""

and then you instantiate that classand you put in the data you want:

auto1 = coolObject("fast", "sleek")auto2 = coolObject("slow", "ugly")

and then you can call these newly created objects...

print auto1.speed

...and how on earth that applies to making computers do neat things is way beyond me. but that's more or less what object oriented programming is all about. next step, go back to school!


0
Sign in to follow this  
Followers 0


0 Comments


There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now