Answer the following statements true (T) or false (F)
1. A constructor is a special kind of member function. It is automatically called when
an object of that class is declared.
2. A constructor is always named construct with class name attached. If the class is
Foo, then the constructor name is constructFoo.
3. A constructor is like a function. It can return any type value needed.
4. A constructor usually terminates by falling off the end of its block, but a return
statement is permitted if there is no argument add following the word return..
5. You can write a class that is useful with all its constructors in the private section.
1. True
The purpose of a constructor is to automatically do any needed
initialization.
2. False
The name of the constructor is just the name of the class.
3. False.
A constructor may not return any value, not even void. There can be no
return type in front of the name.
4. True
Since a constructor may need to terminate prior to falling off then end,
and may need a return statement. However, a constructor cannot return any value
whatsoever, so the return can not have an argument.
5. False
Apart from friend of the class (something you will see later in this
course) a class with all private constructors cannot create an object of the class. It
seems useless to have a class for which you can have no objects..
You might also like to view...
When you specify only the filename, the browser assumes the file is in the same folder as the document containing the hypertext link.
Answer the following statement true (T) or false (F)
A VPN, is another type of network, like LAN or WAN, and means Virtual Personal Network and is mostly used for short range communications.
Answer the following statement true (T) or false (F)
A stereo button is an input control that allows the user to select any number of options from a set of options.
Answer the following statement true (T) or false (F)
COGNITIVE ASSESSMENT Which of the following terms is used to describe a program that copies itself repeatedly, using up resources and possibly shutting down the computer or network?
A. a virus B. a worm C. a Trojan horse D. a rootkit