home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!stanford.edu!rock!concert!duke!jep
- From: jep@cs.duke.edu (Jonathan E. Polito)
- Newsgroups: comp.lang.c++
- Subject: Class scope and class declarations
- Message-ID: <JEP.92Nov6155424@thneed.cs.duke.edu>
- Date: 6 Nov 92 20:54:24 GMT
- Sender: news@duke.cs.duke.edu
- Distribution: comp
- Organization: Duke University CS Dept., Durham, NC
- Lines: 40
- Nntp-Posting-Host: thneed.cs.duke.edu
-
-
- Hello,
- I have a question that seems somewhat open to interpretation.
- I have not been able to find a specific reference in the ARM, nor in
- Lippman's C++ Primer.
-
- It is clear that:
- class X;
-
- class Y {
- public:
- Y();
- private:
- class X* xptr;
- };
-
- class X {
- public:
- int info;
- };
-
- Y::Y() {
- X tmp;
- tmp.info = 1;
- }
-
- will cause tmp to be defined as a class X (at file scope) object. What
- if the first class X; forward declaration is deleted though? Is the
- effect then that xptr in class Y is a pointer to a local class X that
- is never defined? This is one interpretation though I have seen a
- number of programs that rely on class X* to be a forward declaration
- to a class defined later at file scope.
-
- Thanks in advance,
-
- Jon.
- --
- Jonathan Polito DoD #x (K 100)
- jep@cs.duke.edu jpolito@encore.com
- "You Don't Say...." --- Sylvia Plath
-