F
fungus
I've got a base class foo:
class foo {
....
};
And a derived class foo_d:
class foo_d : public foo {
};
I then make another class which takes a foo
in the constructor:
class bar {
public:
bar(foo&);
};
All easy stuff... but when I try this the compiler
complains:
bar b(foo_d());
OTOH this is ok:
foo_d f;
bar b(f);
Why...?
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again. They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful. But it happens
every day. I cannot recall the last time something like
that happened in politics or religion.
- Carl Sagan, 1987 CSICOP keynote address
class foo {
....
};
And a derived class foo_d:
class foo_d : public foo {
};
I then make another class which takes a foo
in the constructor:
class bar {
public:
bar(foo&);
};
All easy stuff... but when I try this the compiler
complains:
bar b(foo_d());
OTOH this is ok:
foo_d f;
bar b(f);
Why...?
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again. They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful. But it happens
every day. I cannot recall the last time something like
that happened in politics or religion.
- Carl Sagan, 1987 CSICOP keynote address