Tuesday, 11 June 2013

Constructors



A constructor does not have any return type. The name of the constructor must be the same as the name of the class in which it is defined. And the only modifiers that can be used on a constructer definition are the access modifiers public, private and protected.
 However, a constructor does have subroutine body of the usual form, a block of statements. There are no restrictions on what statements can be used. And it can have a list of formal parameters.

No comments:

Post a Comment