Topic: Forward declaration of class member functions


Author: jpotter@falcon.lhup.edu (John E. Potter)
Date: 1996/03/22
Raw View
Ron Burk (RonBurk@msn.com) wrote:
: I am having difficulty finding language in the draft
: that establishes the legality or illegality of the following:

: class Forward;

: class Any {
:     friend int Forward::SomeFunc(int SomeArg);
:     };

: It certainly seems like a useful construct, and I don't
: see any impossibility in implementing it

Not enough of a lawyer to find it; however, the basic idea is that you can
not talk about the inside of something that has not been seen.  But I do
see some problems.  Let's add a little bit more from another thread
with discussion of a camel's nose inside of the tent.

class Forward::Node;  // also illegal
Forward::Node* ptr;
...
class Forward {
 private :
  class Node {
   // ...
   };
  int SomeFunc(int SomeArg);
 };

Now what?  You can not talk about a private nested class.  You can't call
a private member function.  Can you make it a friend?  What is the big
picture here?

Enjoy,
John
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: "Ron Burk" <RonBurk@msn.com>
Date: 1996/03/18
Raw View
I am having difficulty finding language in the draft
that establishes the legality or illegality of the following:

class Forward;

class Any {
    friend int Forward::SomeFunc(int SomeArg);
    };

It certainly seems like a useful construct, and I don't
see any impossibility in implementing it, but I don't
have a compiler that accepts it (in fact, the Borland C++ v5.0
beta gets an internal compiler error on it). Can anyone
point me to relevant language in the draft that resolves
this question?

 Thanks,
 Ron Burk
 Windows Developer's Journal
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]