Beruflich Dokumente
Kultur Dokumente
AND
DESTRUCTOR
void main()
{
date today;
}
Error :
The default constructor is defined
under private section; so it is not
accessible in function main( ).
Error :
The constructor should not
return any value. Here
constructor contains return
statement.
b) x = 10, y=20
x = 4, y=20
x = 6, y=8
1. i) default constructor,
ii) parameterized constructor,
iii) copy constructor
2. short note about default
constructor, parameterized
constructor and copy
constructor
3. ~employee( ) { }
7. A constructor is usually
defined in public section.
Why?
Generally a constructor is
defined under the public section
of a class so that its objects can
be created in any function.
8. Is constructor definition
compulsory? Give
justification to support your
answer.
Yes, constructor definition is
compulsory. A Constructor is
defined like other member
functions of a class. It can be
defined either inside or outside
the class specification.