title: Unable to access the parent class member in base class in python
body: <p>I am using python 3.4 and i am new in object oriented programming and want to access the parent class member in my child class. But it is not accessible. Can anyone help me to get rid of this?</p>
  
  <pre><code># Base class members can be accessed in
  # derived class using base class name.
  
  # Parent or super class
  class Company:
  
      def BasicInfo(self):
          self.CompanyName = "ABC Solutions"
          self.Address = "XYZ"
  
  # Inherited or child class
  class Employee(Company):
      # constructor
      def __init__(self, Name):
          print("Employee Name:", Name)
          print("Company Name:", self.CompanyName)
  
  def main():
      # Create an object
      emp01 = Employee("John")
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>The below mentioned code is working but using the same concept, my code is not working, why? Can anyone explain me the reason.</p>
  
  <pre><code>class Room:                                                                     
  
      def __init__(self):                                                         
          self.roomno = 0                                                         
          self.rcap = 0                                                           
          self.rooms = {}                                                         
          self.nog = 10                                                            
  
      def addRoom(self):                                                          
          self.rcap = input("Please enter room capacity:\n")                      
          self.rooms[self.roomno] = self.rcap                                     
  
  class Booking(Room):                                                            
      def addBooking(self):                                                       
          while int(self.nog) &gt; int(self.rcap):                                   
              print("Guest count exceeds room capacity of: %d" % int(self.rcap))  
  
  x = Booking()
  x.addRoom()
  x.addBooking()
  </code></pre>