I have a class which has temporary variables:
// Private temporary classes used by this class.
static C_coordinate3d* tempcoord3d1;
static C_vector3d* tempvector3d1;
static C_line_segment_3d* templineseg3d1;
static C_coordinate3d* tempcoord3d2;
static C_vector3d* tempvector3d2;
static C_line_segment_3d* templineseg3d2;
declared in the class in the header file. In the .cpp file, I have the statements:
// ----------------------------------
// Private temporary classes used by this class.
// Initial values not important as they are changed each time they are used;
// These variables not deleted since they are instantiated for the class, not
// per instance.
C_polygon_flat_surface::tempcoord3d1 = new C_coordinate3d(0, 0, 0);
C_polygon_flat_surface::tempvector3d1 = new C_vector3d(tempcoord3d);
C_polygon_flat_surface::templineseg3d1 = new C_line_segment_3d(tempcoord3d, tempcoord3d);
C_polygon_flat_surface::tempcoord3d2 = new C_coordinate3d(0, 0, 0);
C_polygon_flat_surface::tempvector3d2 = new C_vector3d(tempcoord3d);
C_polygon_flat_surface::templineseg3d2 = new C_line_segment_3d(tempcoord3d, tempcoord3d);
// ----------------------------------
to initialize these members (these are temporary variables that I want to use, but do not want to create every time I create the class.)
The compiler is saying:
c:\game development\math and logic utilities\geometric classes2.cpp(219) : error C2501: 'tempcoord3d1' : missing storage-class or type specifiers
c:\game development\math and logic utilities\geometric classes2.cpp(219) : error C2040: 'private: static class C_coordinate3d * C_polygon_flat_surface::tempcoord3d1' : 'int' differs in levels of indirection from 'class C_coordinate3d *'
etc...
Anyone know why this doesn't work?
// Private temporary classes used by this class.
static C_coordinate3d* tempcoord3d1;
static C_vector3d* tempvector3d1;
static C_line_segment_3d* templineseg3d1;
static C_coordinate3d* tempcoord3d2;
static C_vector3d* tempvector3d2;
static C_line_segment_3d* templineseg3d2;
declared in the class in the header file. In the .cpp file, I have the statements:
// ----------------------------------
// Private temporary classes used by this class.
// Initial values not important as they are changed each time they are used;
// These variables not deleted since they are instantiated for the class, not
// per instance.
C_polygon_flat_surface::tempcoord3d1 = new C_coordinate3d(0, 0, 0);
C_polygon_flat_surface::tempvector3d1 = new C_vector3d(tempcoord3d);
C_polygon_flat_surface::templineseg3d1 = new C_line_segment_3d(tempcoord3d, tempcoord3d);
C_polygon_flat_surface::tempcoord3d2 = new C_coordinate3d(0, 0, 0);
C_polygon_flat_surface::tempvector3d2 = new C_vector3d(tempcoord3d);
C_polygon_flat_surface::templineseg3d2 = new C_line_segment_3d(tempcoord3d, tempcoord3d);
// ----------------------------------
to initialize these members (these are temporary variables that I want to use, but do not want to create every time I create the class.)
The compiler is saying:
c:\game development\math and logic utilities\geometric classes2.cpp(219) : error C2501: 'tempcoord3d1' : missing storage-class or type specifiers
c:\game development\math and logic utilities\geometric classes2.cpp(219) : error C2040: 'private: static class C_coordinate3d * C_polygon_flat_surface::tempcoord3d1' : 'int' differs in levels of indirection from 'class C_coordinate3d *'
etc...
Anyone know why this doesn't work?