S
siddhu
Dear experts,
#include <stdio.h>
class Base
{
};
class Der1ublic Base
{
};
class Der2ublic Base
{
};
int main()
{
Der1 d1;Der2 d2;
Base& b1 = d1;
Base& b2 = d2;
b1 = b2;
}
Above code gets compiled. But I wonder what does the assignment b1 =
b2; do?If these are pointers then its understandable. But how does
above assignment behave in case of references. Does it exhibit UB?
Regards,
Siddharth
#include <stdio.h>
class Base
{
};
class Der1ublic Base
{
};
class Der2ublic Base
{
};
int main()
{
Der1 d1;Der2 d2;
Base& b1 = d1;
Base& b2 = d2;
b1 = b2;
}
Above code gets compiled. But I wonder what does the assignment b1 =
b2; do?If these are pointers then its understandable. But how does
above assignment behave in case of references. Does it exhibit UB?
Regards,
Siddharth