Calling Constructor From Another Constructor
We can also call constructor from another constructor.
Example
We have use this() after every constructor which mean that before executing the constructor go to this() constructor. Human : this("Hello"). It means that before executing Human default constructor compiler will execute Human constructor which takes string as a argument (i.e. Human(string a).
We can also call constructor from another constructor.
Example
We have use this() after every constructor which mean that before executing the constructor go to this() constructor. Human : this("Hello"). It means that before executing Human default constructor compiler will execute Human constructor which takes string as a argument (i.e. Human(string a).
No comments:
Post a Comment