Inner Class Accessing Private Outer Data Dry Run in PYTHON

Inner Class Accessing Private Outer Data is an interactive PYTHON dry run visualizer from the Nestedclass programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Inner Class Accessing Private Outer Data Program Code

class Outer:
    def __init__(self):
        self.__age = 19

    def __outer_show(self):
        print("This is private method of outer class")

    class Inner:
        def get_age(self):
            o2 = Outer()
            o2._Outer__outer_show()
            return o2._Outer__age


o1 = Outer()
oi1 = Outer.Inner()
x = oi1.get_age()
print(x)

View the complete Nestedclass programs page.

Program Console Inner Class Accessing Private Outer Data Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.