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.

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart