home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c++
- Path: sparky!uunet!panther!mothost!motsrd!news
- From: shang@corp.mot.com (David (Lujun) Shang)
- Subject: Re: What does "::" really mean?
- Message-ID: <1992Sep4.140615.9469@cadsun.corp.mot.com>
- Sender: news@cadsun.corp.mot.com
- Reply-To: shang@corp.mot.com
- Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
- References: <1992Sep4.001405.4117@cadsun.corp.mot.com>
- Date: Fri, 4 Sep 92 14:06:15 GMT
- Lines: 49
-
-
- I'd like to add something to my last post on this subject.
-
- Consider an example:
-
- class AA
- { public:
- class NAA {};
- };
-
- class AA1: public AA
- { public:
- class AA
- { public:
- class NAA{};
- };
- };
-
- class AA2: public AA
- { public:
- class AA
- { public:
- class NAA{};
- };
- };
-
- class BB: public AA1, public AA2
- {
- AA1::AA::NAA x; // what is the type of x???
- };
-
- What is the type of member "x" in class BB?
-
- We should use:
-
- AA1.AA.NAA
-
- to denote the class NAA nested in class AA nested in class AA1, and use
-
- AA1::AA.NAA
-
- to denote the class NAA nested in the base class AA of AA1.
-
- To conclude, we use"::" to denote a specific base when the member is ambiguous
- due to multiple inheritace, and we use "." to denote the member or property of
- a qualifying entity ( an object or a class ).
-
- David Shang
-
-