Topic: Naive question about forward references
Author: dgs@Stoner.COM (David Grey Stahl)
Date: Tue, 15 Mar 1994 22:08:02 GMT Raw View
Dear Readers of comp.std.c++:
I have been reading this newsgroup for a short time, I have perused the
comp.lang.c++ FAQ and The Annotated C++ Reference Manual [ARM] to no
avail. My question is simple:
Does the ANSI Standard for C++ require that all ANSI compliant C++
compilers support the use of forward references when the class which
is declared via forward reference is also used as the return
type of member function but is not a data member or base class?
An example will hopefully make my question clearer:
// Example Class
class already_defined_class;
class Example {
public:
void Example();
void ~Example();
already_defined_class MemberFunctionA();
}
The ARM p 196 in the Note states:
Note that a class that has been named but not yet declared cannot be used
as a base class (just as it cannot be used to declare variables - other
than static members - until it has itself been declared).
My reading of the ARM with this reference and the reference on p 167-169
leads me to believe that all syntatically legal uses of the forward
reference class, e.g. already_defined_class, are allowed with the
exception of use as a base class and use as a data member.
Any and all pointers, guidance, and help will be gratefully appreciated.
Sincerely,
David G. Stahl
--
David G. Stahl Stoner Associates
Software Developer P.O. Box 86
Carlisle, PA 17013-0086
David.Stahl@Stoner.Com 717 243 1900 (voice)
d.stahl@ieee.com 717 243 5564 (fax)
******************************************************************************
I do not speak for Stoner Associates.
******************************************************************************
--
David G. Stahl Stoner Associates
Software Developer P.O. Box 86
Carlisle, PA 17013-0086
David.Stahl@Stoner.Com (717) 243-1900