Question: A nondefault constructor Board ( int * * arr, int m , int n ) 1 . If both given parameters m and n are
A nondefault constructor Boardint arr, int m int n If both given parameters m and n are larger than or equal to use m and n to set data members numRows and numCols, respectively, otherwise, set data members numRows and numCols to be Set the elements of panel to be numRows numCols 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. Otherwise, dynamically apply for space to hold a numRows numCols integer array. Put the initial address in data member panel. 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 Boardint m int n Then use constructor delegate to define Board and Boardint 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. 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
