Next: , Previous: Cuboid Data Members, Up: Cuboid Reference


36.2 Constructors and Setting Functions

— Default constructor: void Cuboid (void)

Creates an empty Cuboid.

— Copy constructor: void Cuboid (const Cuboid& c)

Creates a new Cuboid and makes it a copy of c.

— Constructor: void Cuboid (const Point& c, const real h, const real w, const real d, [const real x = 0, [const real y = 0, [const real z = 0]]])

Creates a Cuboid with center at the origin, with height == h, width == w, and depth == d. If x, y, or z is non-zero, the Cuboid is rotated by the amounts indicated around the corresponding main axes. Finally, the Cuboid is shifted such that center comes to lie at c.

          Point P(-3, -2, 12);
          Cuboid c(P, 3, 5, 2.93, 35, 10, 60);


[Figure 186. Not displayed.]

Fig. 186.

— Template specializations: Cuboid* create_new<Cuboid> (const Cuboid* c)
— : Cuboid* create_new<Cuboid> (const Cuboid& c)

Pseudo-constructors for dynamic allocation of Cuboids. They create a Cuboid on the free store and allocate memory for it using new(Cuboid). They return a pointer to the new Cuboid.

If c is a non-zero pointer or a reference, the new Cuboid will be a copy of c. If the new object is not meant to be a copy of an existing one, ‘0’ must be passed to create_new<Cuboid>() as its argument. See Dynamic Allocation of Shapes, for more information.

— Destructor: void ~Cuboid (void)

Deallocates the Rectangles pointed to by the pointers on rectangles (a Solid data member), and calls rectangles.clear(). Cuboids consist entirely of Rectangles, so nothing must be done to the other vectors.