Is there anything that makes you think it might not work?
All code in my posts, unless a source is explicitly mentioned, is my own.
Men Gumani
Ranch Hand
Joined: Apr 01, 2009
Posts: 31
posted
0
The reason I raise this question is that I am reading chap 7 and I see a constructor like this :
I don't know if the one I asked will work or not, if you can explain at which stage the compiler knows type X is there and we can declare it, it would be great, even better if you can tell me the usage of such constructor.
Thanks again.
Ruben Soto
Ranch Hand
Joined: Dec 16, 2008
Posts: 1032
posted
0
The usage of such a constructor is to be used in mock exams to confuse people. That's basically it. In the real world you shouldn't use obscure features of the language, but make your code easy to read and maintain.
The constructor you showed is equivalent to this one:
Men Gumani
Ranch Hand
Joined: Apr 01, 2009
Posts: 31
posted
0
Oh? Sorry buddy, but you sure it is
not
Ruben Soto
Ranch Hand
Joined: Dec 16, 2008
Posts: 1032
posted
0
Men Gumani wrote:Oh? Sorry buddy, but you sure it is
not
Men,
I think it's the way I explained. This test seems to support that: