Facebook
From kush, 4 Years ago, written in Plain Text.
This paste is a reply to Re: 7 from kush - go back
Embed
Viewing differences between Re: 7 and 8
class Person:
    counter = 0
    def __init__(self,name, age):
        self.__name = name
        self.__age = age
    def __str__(self):\n        return("%s is %s years old" %(self.__name,self.__age))\n        Person.counter = (int) (Person.counter) + 1
        self.__id = Person.counter
    @classmethod
    def from_string(cls,person_str):
from_string(cls, person_str):
        l=person_str.split(",")
        cls.__name=l[0]
        cls.__age=int(l[1])
        p=Person(cls.__name,cls.__age)
        return(p)
        
        


        

    def initialize_counter(value):
        Person.counter=value
    def __str__(self):
        return("%s is %s years old and her id is %s" %(self.__name,self.__age,self.__id))
                

Replies to 8 rss

Title Name Language When
9 kush text 4 Years ago.