Quote:
#include <stdio.h>
class A {
public:
void PrintMe();
};
void A::PrintMe()
{
printf("Hello World\n");
}
void main()
{
A* p = 0;
p->PrintMe(); // why not crash
}
|
Go4Expert Member
|
|
| 12Oct2007,20:36 | #1 |
|
Quote:
|
|
Go4Expert Founder
|
![]() |
| 12Oct2007,22:19 | #2 |
|
Because you compiler does find that function where p points.
|
|
Team Leader
|
![]() |
| 12Oct2007,22:46 | #3 |
|
Because your compiler is not standards compliant (neither is MS) in this respect.
Your use of the return type, "void", for main is also non-compliant. |
|
Go4Expert Member
|
|
| 13Oct2007,15:37 | #4 |
|
Quote:
Originally Posted by shabbir |
|
Go4Expert Founder
|
![]() |
| 13Oct2007,18:12 | #5 |
|
Quote:
Originally Posted by vql |