Static Inner classes in Python

Previous
Next

Accessing static functionality:

  • Defining variable or method inside the class.
  • We can access static members using class identity.
  • Inner class need to access with Outer class name.
  • The following example explains how to access the members
class Outer:
    def m1():
        print("Outer-m1")
        return

    class Inner:
        def m2():
            print("Inner-m2")
            return

class Access:
    def main():
        Outer.m1()
        Outer.Inner.m2()
        return

Access.main()
Previous
Next

Add Comment

Courses Enquiry Form