NameTag class : Class Definition « Class « Python






NameTag class

 

class NameTag:
    def __init__(self, myname):
        self.myname = myname
    
    def say(self):
        print "Hello, my name is", self.myname

   
  








Related examples in the same category

1.Class Time with properties
2.Class Time with customized attribute access.
3.Simple class with slots
4.Definition and test function for class Point.
5.User-Defined Classes
6.Class instance value setting
7.Define a class