Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
362 B
7
Indexable
class Myclass:
  #static variable
  __counter = 0

  def __init__(self):
    Myclass.__counter = Myclass.__counter + 1
    self.sno = Myclass.__counter

  @staticmethod 
  def get_counter():
    return Myclass.__counter

  @saticmethod
  def set_counter(new):
    if(new)== int:
      Myclass._counter == new
    else:
      print("not allowed")
Leave a Comment