"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?
[HD Pg 213, Sec. 8.5.3 - constructor-chaining]
Moderator: admin
-
- Posts: 60
- Joined: Thu Apr 15, 2021 12:21 pm
- Contact:
-
- Posts: 60
- Joined: Thu Apr 15, 2021 12:21 pm
- Contact:
Re: [HD Pg 213, Sec. 8.5.3 - constructor-chaining]
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.
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.
Who is online
Users browsing this forum: No registered users and 106 guests