// Define abnormal pointer. cpp: Do you know what it is called abnormal?
// Code by is becoming crazy!
# Include "stdafx. H"
# Include <iostream>
Using namespace STD;
Class B {
Public:
Int *;
Int Foo (int I ){
Cout <"B foo" <I <Endl;
Return I;
}
} B;
Class {
Public:
Int ** C;
B * B;
} Z;
Int main (INT argc, char * argv [])
{
// Define abnormal pointer
Class B * A: * P;
// Assign a value to the abnormal pointer
P = & A: B;
// Assign a value to the abnormal pointer again
Z. * P = new B ();
Printf ("& A: c = % P/N", P );
// Create a B object
B * BP = new B ();
// Define abnormal function pointer
INT (B: * func) (int );
Func = B: Foo;
// Come, use one ~
Cout <"(Z. * P-> * func) (2) =" <(Z. * P-> * func) (2) <Endl;
Cout <"(BP-> * func) (4) =" <(Z. * P-> * func) (2) <Endl;
// Byebye //:~
Return 0;
}
& A: c = 00000004
B Foo 2
(Z. * P-> * func) (2) = 2
B Foo 2
(BP-> * func) (4) = 2