<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Can someone comment on this?<br>
    <br>
    Do we have C-like distinction between access and visible? <br>
    <br>
    I would think not?<br>
    <br>
    If you can access it you can see it, and vice versa? <br>
    I can't think of any other case (i.e. where an identifier would be
    hidden by something that you can't access like in the example below)<br>
    <br>
    <div class="moz-forward-container">We do have the reverse, that a
      public property/function can expose a private type (but not the
      name of the type, just its "content" (enum/members))<br>
      <br>
      <br>
      <br>
      -------- Forwarded Message --------
      <table cellpadding="0" cellspacing="0" border="0"
        class="moz-email-headers-table">
        <tbody>
          <tr>
            <th valign="BASELINE" align="RIGHT" nowrap="nowrap"><br>
            </th>
            <td><br>
            </td>
          </tr>
          <tr>
            <th valign="BASELINE" align="RIGHT" nowrap="nowrap"><br>
            </th>
            <td><br>
            </td>
          </tr>
          <tr>
            <th valign="BASELINE" align="RIGHT" nowrap="nowrap"><br>
            </th>
            <td><br>
            </td>
          </tr>
          <tr>
            <th valign="BASELINE" align="RIGHT" nowrap="nowrap"><br>
            </th>
            <td><br>
            </td>
          </tr>
          <tr>
            <th valign="BASELINE" align="RIGHT" nowrap="nowrap"><br>
            </th>
            <td><br>
            </td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Martin,</p>
      <p>Last week, while we were discussing the FreePascal
        accessibility declarations, I began to wonder whether the
        private/strict private/protected/strict protected keywords
        really were accessibility values or visibility values.  In the
        reference manual, it uses both terms interchangeably.  It says,
        "The visibility of the different sections is...", but then in
        the text for each value, it uses verbiage like "can be
        accessed".  In C++, there are situtations where visibility vs.
        accessibility is an important distinction.  My go-to to expose
        this is hiding rules.  For example:</p>
      <blockquote>
        <p><font face="monospace">int foo = 1;</font><br>
          <br>
          <font face="monospace">class C {</font><br>
          <font face="monospace">private:</font><br>
          <font face="monospace">   int  foo {2};</font><br>
          <font face="monospace">};</font><br>
          <br>
          <font face="monospace">class D : public C {</font><br>
          <font face="monospace">public:</font><br>
          <font face="monospace">   void func()</font><br>
          <font face="monospace">   {</font><br>
          <font face="monospace">      // illegal because C::foo is
            visible here, but not accessible.</font><br>
          <font face="monospace">      // Because C::foo is visible, it
            hides ::foo.      </font><br>
          <font face="monospace">      std::cout << foo <<
            '\n';</font><br>
          <font face="monospace">   }</font><br>
          <font face="monospace">};</font></p>
      </blockquote>
      <p>Or another example:</p>
      <blockquote>
        <p><font face="monospace">class C {<br>
            public:<br>
               int foo { 1 };<br>
            };<br>
            <br>
            class D : public C {<br>
            private:<br>
               int foo { 2 };<br>
            };<br>
            <br>
            int main()<br>
            {<br>
               D  obj;<br>
               // illegal because D::foo is visible here, but not
            accessible.<br>
               // Because D::foo is visible here, it hides C::foo.<br>
               std::cout << obj.foo << '\n';<br>
            }</font><br>
        </p>
      </blockquote>
      <p>My question is: In FreePascal, are there situations like this
        where the private/strict private/protected/strict protected
        names can hide other names at global scope?  Or at any "outer"
        scope, for that matter, if these constructs can be declared
        arbitrarily nested within other constructs, like in Ada.  If
        they all can hide names, to my mind, that rules out using
        visibility as any part of the description.  Instead, if none of
        them can hide other names, then perhaps all of them should be
        visibility values instead.  Or, if it's impossible to construct
        an example in FreePascal that can tell the difference, then
        perhaps I'm just splitting hairs.  :)<br>
      </p>
      <p>Regards,<br>
        Todd Allen<br>
      </p>
    </div>
  </body>
</html>