Identify the constructor like this: If the constructor for class A with two int arguments is called, respond with A(int, int).

Given the class definition,
```
class A
{
public:
A(){}
A(int x, char y):xx(x), yy(y) {}
// other members
private:
int xx;
char yy;
};
```
Tell which definition below is legal.
If legal, tell whether it is a definition of an object of class A.
If the definition is a legal and defines a class A object, tell which constructor is called for each of the following definitions.

a) A x(2, ‘A’);
b) A x;
c) A x = A(2, ‘A’);
d) A x(1);
e) A x( );


a) A x(2, ‘A’); , b) A x; , and c) A x = A(2, ‘A’);

d) is not legal. It tries to call A(int), but there is no such constructor defined. Part e) defines a function taking no arguments and returning a class A object.

Computer Science & Information Technology

You might also like to view...

In the function round of Display 3.6, which of these explains what happens in the body of the function? We reproduce the one line from the function body here:

``` return static_cast(floor(number+0.5)); ``` a) This is overkill, it would be sufficient to use the floor function alone. b) Adding 0.5 to number pushes the range up so floor can produce the correct rounding. c) The static_cast is used because floor returns a double. If the double value were returned, there would be at least a warning of a double to int conversion in returning the value. d) This is wrong. The argument for the floor function should be number-0.5.

Computer Science & Information Technology

String objects are immutable. This means they ________.

a. must be initialized b. cannot be deleted c. cannot be changed d. None of the abov

Computer Science & Information Technology

In a split database, typically, the file containing the back end would reside on the ________ that all departments can access

A) network server B) web browser C) internet D) Navigation Pane

Computer Science & Information Technology

Which of the following section breaks does not have to begin at the top of a page?

A) Odd Page B) Even Page C) Next Page D) Continuous

Computer Science & Information Technology