<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0033)http://www.pixelpot.com/n1218.htm -->
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word"><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content=Word.Document name=ProgId>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR>
<META content="Microsoft Word 9" name=Originator><LINK 
href="./n1218_files/filelist.xml" rel=File-List>
<STYLE>@font-face {
	font-family: Wingdings;
}
@font-face {
	font-family: Tahoma;
}
P.MsoNormal {
	FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
	FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
	FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
A:link {
	COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
	COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
	COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
	COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
P.MsoDocumentMap {
	BACKGROUND: navy; FONT-FAMILY: Tahoma; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoDocumentMap {
	BACKGROUND: navy; FONT-FAMILY: Tahoma; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoDocumentMap {
	BACKGROUND: navy; FONT-FAMILY: Tahoma; FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
P {
	FONT-FAMILY: "Times New Roman"; FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
PRE {
	FONT-FAMILY: "Courier New"; FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; mso-pagination: widow-orphan; mso-fareast-font-family: "Courier New"
}
TT {
	mso-fareast-font-family: "Courier New"; mso-ascii-font-family: "Courier New"; mso-hansi-font-family: "Courier New"; mso-bidi-font-family: "Courier New"
}
DIV.Section1 {
	page: Section1
}
OL {
	MARGIN-BOTTOM: 0in
}
UL {
	MARGIN-BOTTOM: 0in
}
</STYLE>
</HEAD>
<BODY lang=EN-US link=blue style="tab-interval: .5in" vLink=purple>
<DIV class=Section1>
<P align=right style="TEXT-ALIGN: right"><A 
name=class_access_base>SC22/WG21/N1218<BR>J16/99-0042<BR></A><!--[if supportFields]><span style='mso-bookmark:class_access_base'></span><span
style='mso-element:field-begin'></span><span style='mso-bookmark:class_access_base'><span
style="mso-spacerun: yes"></span>SAVEDATE \@ &quot;d MMMM yyyy&quot; \*
MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><SPAN 
style="mso-bookmark: class_access_base">22 October 1999</SPAN><!--[if supportFields]><span
style='mso-bookmark:class_access_base'></span><span style='mso-element:field-end'></span><![endif]--><SPAN 
style="mso-bookmark: class_access_base"><BR>Thomas R 
Wilcox<BR>trw@rational.com</SPAN></P>
<P><SPAN style="mso-bookmark: class_access_base">&nbsp;</SPAN></P>
<P><SPAN style="mso-bookmark: class_access_base"><B><SPAN 
style="FONT-FAMILY: Arial; FONT-SIZE: 13.5pt">Clarifying the Definition of an 
Accessible Base Class (Revision 3)<o:p></o:p></SPAN></B></SPAN></P>
<P><SPAN style="mso-bookmark: class_access_base">This document discusses 
problems with the specification of the concept of <I>accessibility</I> in the 
standard and proposes a possible resolution. The discussion is motivated by four 
items on the core issues list: </SPAN></P>
<OL type=1>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l5 level1 lfo3; tab-stops: list .5in"><SPAN 
  style="mso-bookmark: class_access_base">Issue 9: Clarification of access to 
  base class members</SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l5 level1 lfo3; tab-stops: list .5in"><SPAN 
  style="mso-bookmark: class_access_base">Issue 16: Access to members of 
  indirect private base classes</SPAN> </LI></OL>
<P><SPAN style="mso-bookmark: class_access_base"><B><I><SPAN 
style="FONT-FAMILY: Arial">&nbsp;Issues 9 and 16: Clarification of Access to 
Base Class Members<o:p></o:p></SPAN></I></B></SPAN></P>
<P class=MsoNormal><SPAN style="mso-bookmark: class_access_base">Committee 
document SC22/WG21/N1179 J16/99-0002 proposed extensive changes to clause 11 to 
resolve the logical circularity in the definition of accessible base types that 
exists in the standard and to generally improve the readability and robustness 
of that clause. After discussion at the Dublin meeting in April, 1999, it was 
decided to make only the changes necessary to resolve the issues exposed by the 
above defects. That second proposal, SC22/WG21/N1198 J16/99-0021, attempted to 
resolve the problem simply by adding wording that would prevent the circularity 
in the definition. Review at the Kona meeting revealed that approach to be 
flawed. This document reverts to the original approach, but limits changes to 
only those needed to resolve the defect.</SPAN></P>
<P><SPAN style="mso-bookmark: class_access_base">The major problem with the 
current text is that the definitions of accessible base classes and accessible 
member of base classes are interdependent and circular. The definitions of 
accessible is complex and somewhat non-intuitive. The standard needs to provide 
a definition that the reader may grind through step-by-step to determine if a 
member or base class is accessible. Because the published definitions are 
circular, such a step-by-step procedure is currently not provided.</SPAN></P>
<P class=MsoNormal><SPAN style="mso-bookmark: class_access_base">There are two 
changes. The first change is to reword the definition of <I>accessible base 
class</I> at the start of paragraph 4 so that it parallels the definition of an 
accessible member given at the end of paragraph 4. The second change is to add a 
constraint to the fourth bullet at the end of paragraph 4 to prevent infinite 
recursion of the definition.</SPAN></P>
<P class=MsoNormal><SPAN style="mso-bookmark: class_access_base">After these 
changes, clause 11.2 paragraph 4 (now paragraphs 4 and 5) reads as follows 
(additions shown in red):</SPAN></P><SPAN 
style="mso-bookmark: class_access_base"></SPAN>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><B>4-</B><SPAN 
style="COLOR: red"> A base class B of N is <I>accessible</I> at R, if 
<o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="COLOR: red; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l2 level1 lfo9; tab-stops: list .5in">an 
  invented public member of B would be a public member of N, or <o:p></o:p>
  <LI class=MsoNormal 
  style="COLOR: red; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l2 level1 lfo9; tab-stops: list .5in">R 
  occurs in a member or friend of class <I>N</I>, and an invented public member 
  of B would be a private or protected member of N, or <o:p></o:p>
  <LI class=MsoNormal 
  style="COLOR: red; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l2 level1 lfo9; tab-stops: list .5in">R 
  occurs in a member or friend of a class <I>P</I> derived from <I>N</I>, and an 
  invented public member of B would be a private or protected member of P, or 
  <o:p></o:p>
  <LI class=MsoNormal 
  style="COLOR: red; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l2 level1 lfo9; tab-stops: list .5in">there 
  exists a class S such that B is a base class of S accessible at R and S is a 
  base class of N accessible at R. [<I>Example:</I> <o:p></o:p></LI></UL><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">class B {<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">public:<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>int m;<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">};<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">class S : private B {<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>friend class N;<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">};<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">class N : private S {<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>void f() {<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>B* p = this;<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>// <I>OK: Because class S satisfies the fourth condition above...<o:p></o:p></I></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><I><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// B is a base class of S accessible in f because f is a friend of S and m is private in S</SPAN></I><SPAN style="COLOR: red"><o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// <I>and S is a base class of N accessible in f because f is a member of N and a public<o:p></o:p></I></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// <I>member of S would be private in N.<o:p></o:p></I></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>}<o:p></o:p></SPAN></PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="COLOR: red">};<o:p></o:p></SPAN></PRE>
<P 
style="MARGIN-LEFT: 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="COLOR: red">--- end example] <o:p></o:p></SPAN></P>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><B>-5- 
</B><S><SPAN style="COLOR: purple">A base class is said to be accessible if an 
invented public member of the base class is</SPAN><SPAN style="COLOR: red"> 
</SPAN><SPAN style="COLOR: purple">accessible</SPAN><SPAN 
style="COLOR: red">.</SPAN></S> If a base class is accessible, one can 
implicitly convert a pointer to a derived class to a pointer to that base class 
(<A href="http://www.pixelpot.com/C++/conv.html#conv.ptr">conv.ptr</A>, <A 
href="http://www.pixelpot.com/C++/conv.html#conv.mem">conv.mem</A>). 
[<I>Note:</I> it follows that members and friends of a class <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">X</SPAN></TT> can implicitly 
convert an <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">X*</SPAN></TT> to a pointer 
to a private or protected immediate base class of <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">X</SPAN></TT>. ] The access 
to a member is affected by the class in which the member is named. This naming 
class is the class in which the member name was looked up and found. 
[<I>Note:</I> this class can be explicit, e.g., when a <I>qualified-id</I> is 
used, or implicit, e.g., when a class member access operator (<A 
href="http://www.pixelpot.com/C++/expr.html#expr.ref">expr.ref</A>) is used 
(including cases where an implicit ``<TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">this-&gt;</SPAN></TT>'' is 
added<SPAN style="COLOR: red">)</SPAN>. If both a class member access operator 
and a <I>qualified-id</I> are used to name the member (as in <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">p-&gt;T::m</SPAN></TT>), the 
class naming the member is the class named by the <I>nested-name-specifier</I> 
of the <I>qualified-id</I> (that is, <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">T</SPAN></TT>). If the 
member <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">m</SPAN></TT> is accessible 
when named in the naming class according to the rules below, the access to 
<TT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">m</SPAN></TT> is 
nonetheless ill-formed if the type of <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">p</SPAN></TT> cannot be 
implicitly converted to type <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">T</SPAN></TT> (for example, 
if <TT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">T</SPAN></TT> 
is an inaccessible base class of <TT><SPAN 
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">p</SPAN></TT>'s class). 
]<SPAN style="COLOR: purple">A member <I>m</I> is accessible </SPAN><SPAN 
style="COLOR: red">at the point R</SPAN><SPAN style="COLOR: purple"> when named 
in class <I>N</I> if <o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l4 level1 lfo12; tab-stops: list .5in"><I><SPAN 
  style="FONT-SIZE: 10pt">m</SPAN></I><SPAN style="FONT-SIZE: 10pt"> as a member 
  of <I>N</I> is public, or <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l4 level1 lfo12; tab-stops: list .5in"><I><SPAN 
  style="FONT-SIZE: 10pt">m</SPAN></I><SPAN style="FONT-SIZE: 10pt"> as a member 
  of <I>N</I> is private, and <S>the reference</S> <SPAN 
  style="COLOR: red">R</SPAN> occurs in a member or friend of class <I>N</I>, or 
  <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="COLOR: purple; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l4 level1 lfo12; tab-stops: list .5in"><I><SPAN 
  style="COLOR: windowtext; FONT-SIZE: 10pt">m</SPAN></I><SPAN 
  style="COLOR: windowtext; FONT-SIZE: 10pt"> as a member of <I>N</I> is 
  protected, and <S>the reference</S> </SPAN><SPAN 
  style="COLOR: red; FONT-SIZE: 10pt">R</SPAN><SPAN 
  style="COLOR: windowtext; FONT-SIZE: 10pt"> occurs in a member or friend of 
  class <I>N</I>, or in a member or friend of a class <I>P</I> derived from 
  <I>N</I>, where <I>m</I> as a member of <I>P</I> is private or 
  protected</SPAN><SPAN style="FONT-SIZE: 10pt">, or <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l4 level1 lfo12; tab-stops: list .5in"><SPAN 
  style="COLOR: purple; FONT-SIZE: 10pt">there exists a base class <I>B</I> of 
  <I>N</I> that is accessible at <S>the point of reference</S> </SPAN><SPAN 
  style="COLOR: red; FONT-SIZE: 10pt">R</SPAN><SPAN 
  style="COLOR: purple; FONT-SIZE: 10pt">, and <I>m</I> is accessible 
  </SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt">at R</SPAN><SPAN 
  style="COLOR: purple; FONT-SIZE: 10pt"> when named in class 
  <I>B</I></SPAN><SPAN style="COLOR: olive; FONT-SIZE: 10pt">.</SPAN><SPAN 
  style="FONT-SIZE: 10pt"> [<I>Example:</I> <o:p></o:p></SPAN></LI></UL><PRE style="MARGIN-LEFT: 1.5in">class B;</PRE><PRE style="MARGIN-LEFT: 1.5in">class A {</PRE><PRE style="MARGIN-LEFT: 1.5in">private:</PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>int i;</PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>friend void f(B*);</PRE><PRE style="MARGIN-LEFT: 1.5in">};</PRE><PRE style="MARGIN-LEFT: 1.5in">class B : public A { };</PRE><PRE style="MARGIN-LEFT: 1.5in">void f(B* p) {</PRE><PRE style="MARGIN-LEFT: 1.5in"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>p-&gt;i = 1;<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>//<I><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>OK:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></I><TT>B*</TT><I><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>can be implicitly cast to<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></I><TT>A*</TT><I>,<o:p></o:p></I></PRE><PRE style="MARGIN-LEFT: 1.5in"><TT><SPAN style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>//</TT><I><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>and<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></I><TT>f</TT><I><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>has access to<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></I><TT>i</TT><I><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>in<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></I><TT>A<o:p></o:p></TT></PRE><PRE style="MARGIN-LEFT: 1.5in"><TT>}<o:p></o:p></TT></PRE>
<P 
style="MARGIN-LEFT: 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt"><BR>--- end example] <o:p></o:p></SPAN></P>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">------------------------------------------------------------<o:p></o:p></SPAN></P>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">[<EM>Discussion</EM> of issues....<o:p></o:p></SPAN></P><PRE>Issue 9 Example:</PRE><PRE>&nbsp;&nbsp;&nbsp; class D;</PRE><PRE>&nbsp;</PRE><PRE>&nbsp;&nbsp;&nbsp; class B</PRE><PRE>&nbsp;&nbsp;&nbsp; {</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp; protected:</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int b1;</PRE><PRE>&nbsp;</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friend void foo( D* pd );</PRE><PRE>&nbsp;&nbsp;&nbsp; };</PRE><PRE>&nbsp;</PRE><PRE>&nbsp;&nbsp;&nbsp; class D : protected B { };</PRE><PRE>&nbsp;</PRE><PRE>&nbsp;&nbsp;&nbsp; void foo( D* pd )</PRE><PRE>&nbsp;&nbsp;&nbsp; {</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( pd-&gt;b1 &gt; 0 ); // Is 'b1' accessible?</PRE><PRE>&nbsp;&nbsp;&nbsp; }</PRE>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">Analysis: Is b1 accessible? <o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo15; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">b1 is named in D because the Class D pointer pd is 
  used to address it. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo15; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">In D, b1 is protected, so third or fourth bullet of 
  the definition of an accessible member applies. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo15; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">The third bullet is not satisfied since foo is not a 
  member or friend of D or any of its subclasses. The fourth bullet would apply 
  if the base class B of D is accessible in foo since b1 is a protected member 
  of B and hence accessible when named in B. <o:p></o:p></SPAN>
  <UL type=circle>
    <LI class=MsoNormal 
    style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo15; tab-stops: list 1.0in"><SPAN 
    style="FONT-SIZE: 10pt">Is B an accessible base class of D within foo? 
    Consider the definition of accessible base class... <o:p></o:p></SPAN>
    <UL type=square>
      <LI class=MsoNormal 
      style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level3 lfo15; tab-stops: list 1.5in"><SPAN 
      style="FONT-SIZE: 10pt">Since B is a protected base of D, a public member 
      of B is protected in D. But foo is not a friend of D or any of its base 
      classes and hence none of the bullets in the definition accessible base 
      class apply. Only friends of D have access to its protected base 
      class.<o:p></o:p></SPAN> </LI></UL></LI></UL></LI></UL>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">Issue 16 Example:<o:p></o:p></SPAN></P><PRE>&nbsp; class D;</PRE><PRE>&nbsp;</PRE><PRE>&nbsp; class B {</PRE><PRE>&nbsp; private:</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i;</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friend class D;</PRE><PRE>&nbsp; };</PRE><PRE>&nbsp;</PRE><PRE>&nbsp; class C : private B { };</PRE><PRE>&nbsp;</PRE><PRE>&nbsp; class D : private C {</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void f() {</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B::i; //1: well-formed?</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i;&nbsp;&nbsp;&nbsp; //2: well-formed?</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</PRE><PRE>&nbsp; };</PRE>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">(A) Is i accessible in f when named in B? 
<o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l3 level1 lfo18; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">Since i is a non-static data member, the expression is 
  this -&gt; B::i, so member i must be accessible within f when named in B and B 
  must be an accessible base class of D within f. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l3 level1 lfo18; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">Member i is accessible within f when named in B 
  because i is a private member of B and f is a friend of B. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l3 level1 lfo18; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">However, base class B of D is not accessible within f, 
  because a public member of B would not be a public, protected, or private 
  member of D; it would be a hidden or inaccessible member of D. 
  <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l3 level1 lfo18; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">C is the only intermediate base class of D. C is 
  accessible to D within f since f is a member of D and a public member of C 
  would be private in D. But B is not an accessible base class of C within f 
  since f is neither a friend nor a member of C and there are no base classes 
  between C and B. <o:p></o:p></SPAN></LI></UL>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">(B) Is i accessible in f when named in D? 
<o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l6 level1 lfo21; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">Member i is neither public, protected, or private in 
  D, so if it is accessible, there must be an accessible base class of D where 
  it is accessible. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l6 level1 lfo21; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">C is an accessible base class of D within f because f 
  is a member of D and a public member of C would be a private member of D. 
  <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l6 level1 lfo21; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">Member i is neither a public, protected, or private 
  member of C (because it is a private member of B), so if it is accessible 
  within f, there must be an base class of C accessible within f where it is 
  accessible. <o:p></o:p></SPAN>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l6 level1 lfo21; tab-stops: list .5in"><SPAN 
  style="FONT-SIZE: 10pt">B is not an accessible base class of C because (1) 
  although a public member of B would be a private member of C, f is not a 
  member or friend of C and (2) although f is a member of the subclass D, a 
  public member of B would not be a protected or private member of D. 
  <o:p></o:p></SPAN></LI></UL>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt">So, in both these cases, friendship with the base class 
does not grant access to the private member because the base class is not 
accessible through two levels of private base classes. If, however, B were 
merely a protected base of C rather than a private base of C, then i would be 
accessible within f because B would be an accessible base of D within f (f is a 
member of D and a public member of B would be a private member of D) and it has 
already been established that i is accessible within f when named in B. The B:: 
qualification is redundant in this case. <o:p></o:p></SPAN></P>
<P 
style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><SPAN 
style="FONT-SIZE: 10pt"><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></SPAN></P></DIV></BODY></HTML>
