class CBase {
public:
    void print()
    {
        cout<<"In base print func\n";
    };
};
class CDerived: public CBase {
public:
    void print()
    {
        cout<<"In derived print func\n";
    };
};
int main()
{
    CBase b;
    CBase* pb;
    CDerived d;
    CDerived* pd;
    pd->print();
    return 0;
}
The above code runs fine but when i make the print function in class CBase as virtual it results into segmentation fault.
I think there is some basic logic behind this of which I am not aware. Please give your comments why this is so?
 
     
    