Skip to main content
8 events
when toggle format what by license comment
Jun 14, 2017 at 14:32 vote accept Adrian Larson
Jan 24, 2017 at 1:34 comment added Adrian Larson It just seems like it would make some uses of polymorphism a lot more elegant. I wonder if we might get that someone to wander by and take a look at this question. Stranger things have happened on SFSE.
Jan 23, 2017 at 1:33 comment added Daniel Ballinger Just think of it as calling a chained constructor that happens to use another constructors code. If calling this(); in the first line was really behaving like a constructor then it would be allocating another object on the heap, which is clear is not. Someone with internal knowledge of the Apex bytecode and interpreter could probably explain it better.
Jan 23, 2017 at 1:20 comment added Adrian Larson Very interesting. If that's not calling the constructor...the error message is even more confusing. It's all kind of mind bending.
Jan 23, 2017 at 0:38 comment added Daniel Ballinger That's just the thing. Syntactically you aren't calling "the constructor". To do that you would need to use the new keyword. Instead you are performing constructor chaining. Yes it looks pretty much the same, but they are doing different things. I might see if a fine debug log will show the difference.
Jan 23, 2017 at 0:05 comment added Adrian Larson I'm still not convinced the constructor returns void. If you call the constructor outside of the class, it returns an instance of that class. There is no "return type", but it implicitly returns itself.
Jan 22, 2017 at 22:36 history edited Daniel Ballinger CC BY-SA 3.0
added 282 characters in body
Jan 22, 2017 at 22:30 history answered Daniel Ballinger CC BY-SA 3.0