<jupyter_start><jupyter_text>Parent class and sub class have a same method with same number of arguments and when you call that method from sub class then which method will be called?<jupyter_code>class Vehicle:
    
    def __init__(self, color, maxSpeed):
        self.color = color
        self.__maxSpeed = maxSpeed    #Making maxSpeed as private using '__' before the memeber
    
    def getMaxSpeed(self):            #get method is a public function
        return self.__maxSpeed
    
    def setMaxSpeed(self, maxSpeed):  #set method is a public function
        self.__maxSpeed = maxSpeed
        
    def print(self):                            #Another way of accessing printing private members --> printing within a class
        print("Color : ",self.color)
        print("MaxSpeed :", self.__maxSpeed)

class Car(Vehicle):
    
    def __init__(self, color, maxSpeed, numGears, isConvertible):
        
        super().__init__(color, maxSpeed) #Inheriting from vehicle class       
        self.numGears = numGears          #Passing via arguments in car class
        self.isConvertible = isConvertible 
        
    def print(self):
        print("NumGears :", self.numGears)
        print("IsConvertible :", self.isConvertible)
        
c = Car("red", 35, 5, False)
c.print()   #Car print() is printed<jupyter_output>NumGears : 5
IsConvertible : False<jupyter_text>** Eventhough the print() is available in both Vehicle and Car class, print() of Car (derived class) got executed because it's called from derived class  Ans) First it checks the child class in which the print() is called if it's not there then the control goes to its parent class if it's not there then the control goes to it's parent class and so on and so forth<jupyter_code>class Vehicle:
    
    def __init__(self, color, maxSpeed):
        self.color = color
        self.__maxSpeed = maxSpeed    #Making maxSpeed as private using '__' before the memeber
    
    def getMaxSpeed(self):            #get method is a public function
        return self.__maxSpeed
    
    def setMaxSpeed(self, maxSpeed):  #set method is a public function
        self.__maxSpeed = maxSpeed
        
    def print(self):                            #Another way of accessing printing private members --> printing within a class
        print("Color : ",self.color)
        print("MaxSpeed :", self.__maxSpeed)

class Car(Vehicle):
    
    def __init__(self, color, maxSpeed, numGears, isConvertible):
        
        super().__init__(color, maxSpeed) #Inheriting from vehicle class       
        self.numGears = numGears          #Passing via arguments in car class
        self.isConvertible = isConvertible 
        
       
c = Car("red", 35, 5, False)
c.print()   #Car print() is printed<jupyter_output>Color :  red
MaxSpeed : 35
{'fraction_non_alphanumeric': 0.07692307692307693, 'fraction_numerical': 0.003205128205128205, 'mean_word_length': 2.605905006418485, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '513731', 'license': 'Unlicense', 'n_tokens_mistral': 787, 'n_tokens_neox': 763, 'n_words': 286, 'path': '04 OOPS-2/4.3 Inheritance cont.....ipynb', 'repo_name': 'suhassuhas/Coding-Ninjas---Data-Structures-and-Algorithms-in-Python', 'size': '2808'}