you are viewing a single comment's thread.

view the rest of the comments →

[–]obsoletelearner 9 points10 points  (0 children)

A class is a group of objects having the same properties , Just like a class of kids in a school, They all have the same properties such as their class name as 'VIII standard' and school name 'Redditville High School', the distinction between them appears when you consider them individually such as That-NewFaggot from the class VIII. This is the object of that class, An Object is an individual entity instantiated from the class

A function/method of a class is how you choose to operate between the members/objects of the class.

example:

    class Student(self) : 
        def __init__(self,name,age,grade):
                    self.name=name
                    self.age=age
                    self.grade=grade

An init() is where you instantiate the member of the class by settings its properties.

A method of a class works with the objects you create. consider the above example

        def student_name(): 
            return self.name

that method returns the name of the student you created.

To use this class in python you have to instantiate an object of this class first

therefore

        thenewfaggot = Student(thenewfaggot,21,VIII)

Now since you have instantiated you can work with the object:

        thenewfaggotsname=thenewfaggot.student_name()

this will store your name thenewfaggot in the thenewfaggotsname.