मराठी

Explain the concept of overriding methods.

Advertisements
Advertisements

प्रश्न

Explain the concept of overriding methods.

कोड लेखन
स्पष्ट करा
Advertisements

उत्तर

Method overriding happens when a derived class defines a method with the same name as a method in its base class. The derived-class version is called when the method is invoked using a derived-class object.

class Person(object):
    def show(self):
        print("Person")

class Student(Person):
    def show(self):
        print("Student")
 
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 4: Inheritance - EXERCISE [पृष्ठ ७८]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
पाठ 4 Inheritance
EXERCISE | Q 11. | पृष्ठ ७८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×