title: Julia - Check object has attribute
body: <p>Suppose I have <code>struct</code> as below.</p>
  
  <pre><code>struct Foo
      attr1
      attr2
  end
  </code></pre>
  
  <p>I can then instantiate and get the <code>attr1</code> and <code>attr2</code></p>
  
  <pre><code>julia&gt; foo = Foo(1,2)
  
  julia&gt; foo.attr1
  1
  </code></pre>
  
  <p>I'm just wondering if I can do any checking that my object <code>foo</code> has <code>attr1</code>?</p>
  
  <p>For reference, <code>python</code> has <a href="https://docs.python.org/3/library/functions.html#hasattr" rel="nofollow noreferrer"><code>hasattr</code></a> which exactly what I'm looking for here, but I couldn't seem to find the equivalent in <code>julia</code>.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>EDIT</strong>: I'm in Julia 1.1.0</p>