title: Code example racket racket/gui classes
body: <p>I am coming from Java and Python, and am having difficulty understanding how object-oriented code works in Racket.</p>
  
  <ol>
  <li><p>Given</p>
  
  <pre><code>(define food%
   (class object%
      (super-new)
      (init-field name)
      (field (edible? #t))
      (init-field healthy?)
      (init-field tasty?) ) )
  </code></pre>
  
  <p>define a superclass fruit% of food% which always has the healthy? value of #t, and
  which doesn't require one to set the healthy? field when defining a new fruit.</p></li>
  <li><p>In racket/gui, define a super-class of button% called text-input-button% which has two new fields, output (ideally of type text-field%) and text (ideally a string), and whose callback field has as its value a function which appends the value of the text field to the current contents of the value of the output field. Practically, the buttons would input characters into the text-field specified.</p></li>
  </ol>
  
  <p>I think if I can see these two examples, a large amount of my confusion will be resolved. That being said, I am looking for the 'proper' or textbook means of doing this, rather than some round-about trick using set!, unless that is all the proper method boils down to.</p>