<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Encapsulation in python - What would be the output of the following code? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/encapsulation-in-python-what-would-be-the-output/m-p/1157331#M64146</link>
    <description>&lt;P&gt;Hey, welcome to the ESRI community!&lt;/P&gt;&lt;P&gt;This is a forum specifically for all GIS products of ESRI. If you have nothing to do with that and only have questions about Python, this might not be the best place to ask.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What will be the output? Well, have you tried to run it?&lt;/P&gt;&lt;P&gt;You create a BaseClass object and run its display() method. This method prints two attributes (a &amp;amp; __c) of the object. You don't do anything with the derived class.&lt;/P&gt;&lt;P&gt;The output will be "GoForGyan goforgyan".&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2022 15:00:53 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-03-24T15:00:53Z</dc:date>
    <item>
      <title>Encapsulation in python - What would be the output of the following code?</title>
      <link>https://community.esri.com/t5/python-questions/encapsulation-in-python-what-would-be-the-output/m-p/1157265#M64143</link>
      <description>&lt;P&gt;Wanted to understand what would be the output of this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class BaseClass:
    def __init__(self):
        self.a = "GoForGyan"
        self.__c = "goforgyan"

    def display(self):
        print(self.a,self.__c)


class Derived(BaseClass):
    def __init__(self):
        BaseClass.__init__(self)
        print(self.__c)


obj1 = BaseClass()
obj1.display()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:39:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/encapsulation-in-python-what-would-be-the-output/m-p/1157265#M64143</guid>
      <dc:creator>rraahhaaddii09</dc:creator>
      <dc:date>2022-03-24T13:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulation in python - What would be the output of the following code?</title>
      <link>https://community.esri.com/t5/python-questions/encapsulation-in-python-what-would-be-the-output/m-p/1157331#M64146</link>
      <description>&lt;P&gt;Hey, welcome to the ESRI community!&lt;/P&gt;&lt;P&gt;This is a forum specifically for all GIS products of ESRI. If you have nothing to do with that and only have questions about Python, this might not be the best place to ask.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What will be the output? Well, have you tried to run it?&lt;/P&gt;&lt;P&gt;You create a BaseClass object and run its display() method. This method prints two attributes (a &amp;amp; __c) of the object. You don't do anything with the derived class.&lt;/P&gt;&lt;P&gt;The output will be "GoForGyan goforgyan".&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 15:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/encapsulation-in-python-what-would-be-the-output/m-p/1157331#M64146</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-03-24T15:00:53Z</dc:date>
    </item>
  </channel>
</rss>

