delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/09/10:56:02

Message-ID: <35A435EE.F92F5D49@uol.com.br>
Date: Thu, 09 Jul 1998 00:15:58 -0300
From: "Juciê Dias Andrade" <jucie AT uol DOT com DOT br>
MIME-Version: 1.0
To: Nicklas Lindgren <nil AT hem1 DOT passagen DOT se>
CC: djgpp AT delorie DOT com
Subject: Re: static members
References: <35a3d453 DOT 7807828 AT news DOT algonet DOT se>

> class Interface {
>   static Interface killer; // ****** here it is

When the compiler finds the above declaration it thinks: "Ok, now I know
there will be a static Interface object named 'Interface::killer'
somewhere". Then you can do references to that object, like these ones: 

>     return (&killer);
>   } while (interface != &Interface::killer);

The error reported by the linker is because you didn't put a
"definition" in any module. You can put the folowing line in the
corresponding Interface.CPP file:

	Interface Interface::killer;

This will allocate the memory needed by the instance. Your linker will
be happy and that's all.
Bye.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019