The problem with inheritance and the link "self"

This is my first post, so first of all I want to say gigantic "Thank you!" to the stackoverflow community all the time the answer helped :)

I have a problem while working with python inheritance.

I have a parent class that contains the following code:

def start(self):

  pid = os.fork()

  if (pid==0):
   self.__do_in_forked_process()
  elif(pid > 0):
   self.__do_in_parent_process()
  else:
   print ("Error while forking...")
   sys.exit(1)

The __do_in_forked_process () method contains a method self.__manage_request()that is defined in the parent class and overridden in the child class.

, self.start(), : self.__ manage_request() - , , define ( , , self.start() start, , ).

!

turkishweb

+3
1

TWO : , , ! _manage_request ( ) . , , ( ) ( ).

++ protected: . private: "hands-off" ( , ). , .

+6

Source: https://habr.com/ru/post/1760117/


All Articles