Question: A nondefault constructor Board ( int * * arr, int m , int n ) 1 . If both given parameters m and n are

A nondefault constructor Board(int** arr, int m, int n)1. If both given parameters m and n are larger than or equal to 2, use m and n to set data members numRows and numCols, respectively, otherwise, set data members numRows and numCols to be 3. Set the elements of panel to be 1,2,, numRows * numCols-1. The numbers are placed from the top row to the bottom row, and in each row, from left to right. No randomize is needed at this step. 2. Otherwise, dynamically apply for space to hold a numRows * numCols integer array. Put the initial address in data member panel. 3. Set the elements of panel to be the same arrangement as that of given parameter arr. You may notice that there are a lot of common codes among those constructors. A better way is to define Board(int m, int n). Then use constructor delegate to define Board() and Board(int** arr, int m, intors in Board.cpp The purpose of constructor is to initialize data members. A class may have multiple constructors. Different constructors have different parameter lists. Each constructor has exactly the same name as class, no return type, not even void. 2.1 The default constructor Board() The default constructor does not take any parameter. It does the following:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!