Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > oop in python

Reply
Thread Tools

oop in python

 
 
Gerald99 Gerald99 is offline
Junior Member
Join Date: May 2011
Posts: 1
 
      05-31-2011
class base():
insCounter=0

def __init__(self):
self.__class__.insCounter +=1

def insPrint(self):
print self.__class__.insCounter



class tester(base):
insCounter=2

def __init__(self):
self.__class__.insCounter+= 1

def insPrint(self):

base.insPrint( tester() ) # ------->>> use v ,tester(), base()

v=tester()
v.insPrint()
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python's OOP question neoedmund Python 24 10-18-2006 05:01 PM
OOP techniques in Python Panos Laganakos Python 18 05-01-2006 12:32 PM
About classes and OOP in Python fyhuang Python 19 04-12-2006 11:10 AM
Global Variables in OOP and Python newbie Python 9 01-01-2006 03:55 PM
oop in python novice Python 5 12-30-2005 07:21 PM



Advertisments