Software & Finance





Python - Class Example





 

I have given here python program explaining on how to write your first Python Class

This code is tested with Python version 2.6

 

        class CEmployee:
           age = 0
           name = ""
           def __init__ (self, name, age):
              self.name   = name
              self.age    = age
           def PrintRecord(self):
              print self.name, self.age
        
        
        s = CEmployee("Kathir", 33);
        s.PrintRecord()

		#output
        #kathir 33