I define my classes as follow

class A
{
};

class B : public A
{
public:
void functionB(void);
};

main()
{
A* objectB=new B;
objectB->functionB(); // this should be OK

A* objectA=new A;
((B*)objectA)->functionB(); // this is OK too, why?
}

suppose functionB() is the member of class B, it shouldnt be right to be called by A object. However I did it no problem, why?

Any side effect if I do this?