Python is object oriented language with support to many OO concepts.
A very simple sample of class and member methods -
class MyClass:
def __init__(self, id):
self.id = id;
def showId(self):
print "Value of Id is :"+str(self.id);
return;
def __del__(self):
print "Deleting the object...";
myCls = MyClass(10);
myCls.showId();
del myCls;
O/P -
Value of Id is :10
Deleting the object...
02-08-2013
No comments:
Post a Comment