Afficher un message
Vieux 15/01/2008, 16h59   #1
Luis Angel Fernandez Fernandez
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Why pA->foo() works in this code?

Hi

why this code works?

#include <iostream>

class A {
public:
void foo() {std::cout << "hi" << std::endl; };
};

void MakeA(A *pA) { pA = new A; }

int main() {
A* pA = NULL;
Make(pA);
pA->foo();
delete pA;

return 0;
}

And... why ((A*)NULL)->foo() works too?

Thanks in advance.
  Réponse avec citation
 
Page generated in 0,04892 seconds with 9 queries