In reply to bachan21:
Quote:
In reply to bl4ckp3rl :
Hi Thanks for the reply.
Why do we avoid mentioning void return type to new() constructor
Because it would be redundant.
This is patterned after other OOP languages like C++ and Java. The return type of the constructor can only be one type, the type of the class it is declared within. If you had to declare the return type, people might think you had a choice, which you don't. Since new is a keyword, not a regular identifier, we can put this into the syntax.