1. What is the necessity of virtual destructor?
2. What is an inline function?
3. What is memory alignment?
4. Pass by value, pass by pointor, and pass by reference
5. Write output:
Class
{
Public:
A ()
{
Printf ("1 ");
}
~ A ()
{
Printf ("2 ");
}
Void print_function ()
{
Printf ("3 ");
}
};
Class B: public
{
Public:
B ()
{
Printf ("4 ");
}
Virtual ~ B ()
{
Printf ("5 ");
}
Virtual void print_function ()
{
Printf ("6 ");
}
};
Class C: Public B
{
Public:
C ()
{
Printf ("7 ");
}
Virtual ~ C ()
{
Printf ("8 ");
}
Virtual void print_function ()
{
Printf ("9 ");
}
};
Int _ tmain (INT argc, _ tchar * argv [])
{
A * A = new B ();
Printf ("\ n ");
A-> print_function ();
Printf ("\ n ");
B * B = new C ();
Printf ("\ n ");
B-> print_function ();
Printf ("\ n ");
Delete B;
Printf ("\ n ");
Delete;
Return 0;
}
6. Code implementation: outputs the prime number in 1000;
7. Use ">>< & | ~ "Code optimization:
Int A = B * 4;
Int A = B * 72;
Int A = B/8;
Int A = B % 1;
Int A = B % 16;
Int A = (B * 3)/8;
Int A = (B + C)/2;
Int A = (B % 8) * 4;