class cbase
{
public:

virtual void func(int a = 10)
{
std::cout << "this is cbase func:" << a << std::endl;
}
};

class csub : public cbase
{
public:
void func(int a = 20)
{
std::cout << "this is csub func:" << a << std::endl;
}
};

int _tmain(int argc, _TCHAR* argv[])
{

cbase * cbToCb = new cbase;
cbase * cbTocSub = new csub;
csub * cSubTocSub = new csub;
cbToCb->func(); // "this is csub func:10"
cbTocSub->func(); // "this is csub func:10"
cSubTocSub->func(); // "this is csub func:20"
return 0;
}