🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1045

Re: gcc 2.2.2 (C++)

#1045
From: James Brister
Date: Fri, 09 Oct 1992 18:23
29 lines
1143 bytes
On Fri, 9 Oct 1992 11:26:04 GMT, mano@arch04.acri.FR (S Manoharan) said:

> Static members of user defined-type generate link-time errors.

> #include <stdio.h>

> class Foo {
> private:
>   int dummy;
> public:
>    Foo()	{ dummy = 10; }
>    int bar()	{ return 2*dummy; }
> };

> class Test {
> protected:
>    static Foo s;
> public:
>    virtual int show()	{ return s.bar(); }
> };

You need to create the instances. You've only declared the objects:

	Foo Test::s ;

James
--
James Brister                                           brister@wsl.pa.dec.com
DEC Western Software Lab., Palo Alto, CA                        decwrl!brister
Technical Details
Message-ID: <BRISTER.92Oct9142323@tirade.decwrl.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!decwrl.dec.com!brister
References: brister@decwrl.dec.com (James Brister)

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!decwrl.dec.com!brister
From: brister@decwrl.dec.com (James Brister)
Subject: Re: gcc 2.2.2 (C++)
Message-ID: <BRISTER.92Oct9142323@tirade.decwrl.dec.com>
Sender: gnulists@ai.mit.edu
Organization: DEC Western Software Lab
References: brister@decwrl.dec.com (James Brister)
Distribution: gnu
Date: Fri, 9 Oct 1992 18:23:23 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 30