This is a mirror of official site: http://jasper-net.blogspot.com/

I'm not calling a virtual function from my constructor or destructor, but I'm still getting a __purecall error

| Monday, September 3, 2012
Some time ago, I described what __purecall is for: It's to detect the cases where you call a virtual method with no implementation (a so-called pure virtual method). This can happen during object constructor or destruction, since those are times when you can validly have a partially-implemented object.

Well, there's another case this can happen: If the object has already been destructed.

If you call a method on an object that has already been destructed, the behavior is undefined. In practice, what happens is that the method runs on whatever leftover values are in memory where the object used to be. Depending on how lucky or unlucky you area, this may resemble the actual object closely enough that the method doesn't notice, or at least doesn't notice for a while, or maybe it can't even get off the ground.

QR: Inline image 1

Posted via email from Jasper-net

0 comments: