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.
Identify the constructor like this: If the constructor for class A with two int arguments
is called, respond with A(int, int).
a)```
A x(2, ‘A’);
```
b)```
A x;
```
c)```
A x(1);
```
e)```
A x( );
```

Part a) is legal, A(int,char) is called. Part b) is legal, the default constructor,
A( ) is called. This is sometime (in truth, infrequently) written A(void). Part c) is
legal, A(int, char) is called.
Explanation:
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...

Little circles located in front of various options, which can be selected with the mouse, are called ________.

A. hyperlinks B. radio buttons C. text boxes D. web portals

Computer Science & Information Technology

The Economic Espionage Act of 1996 protects American ingenuity, intellectual property, and competitive advantage. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology