Page 1 of 1

[HD Pg 213, Sec. 8.5.3 - constructor-chaining]

Posted: Fri Jul 23, 2021 5:02 am
by enthunoob
"It is in fact against the rules to try to invoke another constructor using the constructor name and it will result in a compilation error."

I think what is meant here is:

"It is in fact against the rules to try to invoke another constructor using the constructor name and parameters, as in with the same ammount of parameters as where the other constructor is being called from, and it will result in a compilation error."

Right?

Re: [HD Pg 213, Sec. 8.5.3 - constructor-chaining]

Posted: Fri Jul 23, 2021 5:05 am
by enthunoob
Oh I see, after reading it a 4th time. It's about the word this.

When calling a constructor from another constructor, you always have to call it with the word 'this' (and it's illegal to use the classes name when chaining another constructor). Got it.