Difference between this. and this->
One will compile, one won’t. this is a pointer, and you can’t apply . to a pointer. Use -> to access members of the object it points to.
One will compile, one won’t. this is a pointer, and you can’t apply . to a pointer. Use -> to access members of the object it points to.
this(0); is an example of constructor delegation. Here you’re calling, from a constructor, the constructor that takes an pair of ints as an argument. To exploit this idiom, the call to another constructor must be the first statement of the calling constructor. The rest of the behaviour is adequately explained with a line by line … Read more