caperover2002
January 5th, 2006, 08:31 AM
Hi, all
I am running into a very interesting problem, which has been bothering me for a while.
I have a base class
class B
{
public:
virtual bool fun() =0;
}
and two derived classes
class A : public B
{
public:
virtual bool fun()
{
return false;
}
}
and
class C : public B
{
public:
virtual bool fun()
{
return false;
}
}
One thing that is very interesting is that if the following line appears anywhere in my managed code, whether it is executed or not,
A a;
the function C:fun's return value will become true.
What I am trying to understand is the difference it makes with or without "A a". Any hint or suggestion will be really appreciated!
Thanks.
I am running into a very interesting problem, which has been bothering me for a while.
I have a base class
class B
{
public:
virtual bool fun() =0;
}
and two derived classes
class A : public B
{
public:
virtual bool fun()
{
return false;
}
}
and
class C : public B
{
public:
virtual bool fun()
{
return false;
}
}
One thing that is very interesting is that if the following line appears anywhere in my managed code, whether it is executed or not,
A a;
the function C:fun's return value will become true.
What I am trying to understand is the difference it makes with or without "A a". Any hint or suggestion will be really appreciated!
Thanks.