home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / std / cplus / 1129 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  1.8 KB

  1. Xref: sparky comp.std.c++:1129 comp.lang.c++:13281
  2. Newsgroups: comp.std.c++,comp.lang.c++
  3. Path: sparky!uunet!ftpbox!motsrd!news
  4. From: shang@corp.mot.com (David (Lujun) Shang)
  5. Subject: What does "::" really mean?
  6. Message-ID: <1992Sep4.001405.4117@cadsun.corp.mot.com>
  7. Sender: news@cadsun.corp.mot.com
  8. Reply-To: shang@corp.mot.com
  9. Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
  10. Date: Fri, 4 Sep 92 00:14:05 GMT
  11. Lines: 40
  12.  
  13.  
  14. Basically, operator:: does not mean to qualify an identifier. It only 
  15. suggests the path to search for the identifier. For example, in expression:
  16.  
  17.    anObject.aClass::aMember
  18.  
  19. anObject is the qualifier, and aClass suggests that aMember is defined in  
  20. aClass or in one of its bases.
  21.  
  22. A nested class should be a property of its enclosed class, not the property 
  23. of its object, therefore we should use expression
  24.  
  25.    aEnclosingClass.aNestedClass
  26.  
  27. to access the nested class. Mircosoft C/C++7.0 choses to use
  28.  
  29.    aEnclosingClass::aNestedClass
  30.  
  31. This brings ambiguity. If I have an expression:
  32.  
  33.    C1::C2::C3:: ... ::X
  34.  
  35. what is the relationship of Ci and Ci-1? The base-derive relationship or 
  36. the enclosing-nested relationship? How about when the nested class happened 
  37. to be the same name of one of the base classes of its enclosing class?  
  38. (consider the fact that the name of a class member can be the same name of 
  39. its class or the base class.)
  40.  
  41. Its rather controversial to argue whether we should use "." or "::" to 
  42. access a static member. It depends whether the static member is belong 
  43. to the property of the class or the property of the object. To makes 
  44. things clear, I would rather to treat static member as the property of 
  45. the class, so we should use "." to accress a static member.
  46.  
  47. If we want to access the class property through an object, we should use
  48.  
  49.     typeof(anObject).aClassProperty
  50.  
  51. David Shang
  52.  
  53.