Question: Predict the output and fill the comment box with adequate statements: #include using namespace std; class Box { public: static int objectCount; // ____________________________________________________C1 Box(double
Predict the output and fill the comment box with adequate statements: #include using namespace std; class Box { public: static int objectCount; // ____________________________________________________C1 Box(double l = 2.0, double b = 2.0, double h = 2.0) { cout <<"Constructor called." << endl; length = l; breadth = b; height = h; // __________________________________C2 objectCount++; } double Volume() { return length * breadth * height; } static int getCount() { return objectCount; } private: double length; // Length of a box double breadth; // Breadth of a box double height; // Height of a box }; // ________________________________________C3 int Box::objectCount = 0; int main(void) { // _____________________________________________________C4 cout << "Inital Stage Count: " << Box::getCount() << endl; Box Box1(3.3, 1.2, 1.5); // Declare box1 Box Box2(8.5, 6.0, 2.0); // Declare box2 // _____________________________________________________C5 cout << "Final Stage Count: " << Box::getCount() << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
