home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turbo Toolbox
/
Turbo_Toolbox.iso
/
dtx9203
/
borhot
/
static.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-24
|
1KB
|
38 lines
/* ------------------------------------------------------ */
/* STATIC.CPP */
/* Initializing Static Class Members of Type Class */
/* (c) 1991 Borland International */
/* All rights reserved. */
/* ------------------------------------------------------ */
/* veröffentlicht in DOS toolbox 3'92 */
/* ------------------------------------------------------ */
// declare a class
class First {
public:
int count;
First() {} // must have callable constructor
};
// declare class containing static member of class First
class Second {
public:
static First fVar;
};
// initialize static member of class Second
First Second::fVar = First();
// initialize with explicit call to ctor
/* ------------------------------------------------------ */
int main(void)
{
Second *sVarA = new Second;
delete sVarA;
return 0;
}
/* ------------------------------------------------------ */
/* STATIC.CPP */