Hello, im starting out in c++ and i want to know why this code prints out base
i know that when making a program like this in java the output would be derived.. I would like to know how it works in c++. thank you for your timeCode:struct base { virtual void foo(void){ cout<<"base"<<endl; } } struct derived : base(void) { void foo(void){ cout<<"derived"<<endl; } } int main (void) { base *b = new derived; b -> foo(); return 0 }