Alright, simple problem, hopefully simple solution.
This is going to seem like a stupid question, I know but I'm having some difficulty with struct inheritance.
Here's what I have:
struct A
{
//elements here
}
struct B:A
{
//more elements here
}
int main(void)
{
A* pa = new B();
B* pb;
pb = pa;//this is the important part
return 0;
}
Do I need an explicit cast here?
Also, say I was trying to do:
A a;
B b;
b = a;
Do I need a new constructor B(A a) in B to handle this or is there another way?