title: How to show field values in Julia
body: <p>I was wondering if there is a possibility to show field values in Julia.</p>
  <p>For example, this Python program, gets the object variable <code>wealth</code> from the consumer class:</p>
  <pre><code>   class Consumer:
  
      def __init__(self, w):
          &quot;Initialize consumer with w dollars of wealth&quot;
          self.wealth = w
  
      def earn(self, y):
          &quot;The consumer earns y dollars&quot;
          self.wealth += y
  
      def spend(self, x):
          &quot;The consumer spends x dollars if feasible&quot;
          new_wealth = self.wealth - x
          if new_wealth &lt; 0:
              print(&quot;Insufficent funds&quot;)
          else:
              self.wealth = new_wealth
  
  c1.wealthc1 = Consumer(10) # Create instance with initial wealth 10
  c1.spend(5)
  c1.wealth
  </code></pre>
  <p>The wealth variable is <code>5</code>. I want to know how can I translate this code to Julia.</p>