oop in python

Discussion in 'Python' started by Gerald99, May 31, 2011.

  1. Gerald99

    Gerald99

    Joined:
    May 31, 2011
    Messages:
    1
    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()
     
    Gerald99, May 31, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. novice

    oop in python

    novice, Dec 27, 2005, in forum: Python
    Replies:
    5
    Views:
    319
    jmdeschamps@gmail.com
    Dec 30, 2005
  2. newbie
    Replies:
    9
    Views:
    1,070
    Steven D'Aprano
    Jan 1, 2006
  3. fyhuang

    About classes and OOP in Python

    fyhuang, Apr 10, 2006, in forum: Python
    Replies:
    19
    Views:
    545
    bruno at modulix
    Apr 12, 2006
  4. Panos Laganakos

    OOP techniques in Python

    Panos Laganakos, Apr 27, 2006, in forum: Python
    Replies:
    18
    Views:
    483
    Philippe Martin
    May 1, 2006
  5. neoedmund

    python's OOP question

    neoedmund, Oct 16, 2006, in forum: Python
    Replies:
    24
    Views:
    628
    Dennis Lee Bieber
    Oct 18, 2006
Loading...

Share This Page