The reason is because this greet()is a method static. References to static methods through variables do not result in dereferencing the pointer. The compiler should have warned you about this.
If you remove the modifier static, you will getnpe
source
share