home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13638 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.0 KB  |  49 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!umn.edu!news.cs.indiana.edu!usenet.ucs.indiana.edu!nsundare@silver.ucs.indiana.edu
  3. From: Neelakantan Sundaresan <nsundare@silver.ucs.indiana.edu>
  4. Subject: Another one on friends of templates
  5. Message-ID: <BuLBBM.Ity@usenet.ucs.indiana.edu>
  6. Sender: <nsundare@silver.ucs.indiana.edu>
  7. Organization: Indiana University
  8. Date: Mon, 14 Sep 1992 22:47:40 GMT
  9. X-Mailer: ELM [version 2.3 PL11]
  10. Lines: 37
  11.  
  12.  
  13. on CC,
  14. The following would work...
  15. --------
  16. class X {
  17. private:
  18.        enum {a=100};
  19.        int i;
  20.        friend class Y;
  21.      };
  22. class Y { int v[X::a];
  23.           f(X *x) { return x->i;};};
  24. -----------
  25.  
  26. But this one wouldnot...
  27. ----------
  28. template <class templ> class T {
  29.  public:
  30.       T() {};
  31.  private:
  32.       friend class C;
  33.       int l;
  34. };
  35. class W { public: W(){};};
  36. typedef T<W> neel;
  37.  
  38. class C 
  39. {
  40.   dummy(neel *c) { return c->l;};
  41.                           ^^^ access to private member of T<W>?
  42.   public: C() { };
  43. };
  44. ------------
  45.  
  46. any clues?
  47. thanks
  48. neel.
  49.