[function] Defect or feature?
9 Nov
2009
9 Nov
'09
6:38 p.m.
Hello. I think this code should work (or convince me why not):
#include
9 Nov
9 Nov
6:53 p.m.
AMDG Germán Diago wrote:
Hello. I think this code should work (or convince me why not):
#include
class A {}; class B : public A {};
typedef boost::function
F; void hello(B &) { }
int main() { F f(&hello); }
Since A & can accept Bs &, should this code work?
No it shouldn't. hello takes a B&. F can take any A& even one
that isn't really a B. It would work if it were the other way around:
typedef boost::function
5480
Age (days ago)
5480
Last active (days ago)
1 comments
2 participants
participants (2)
-
Germán Diago
-
Steven Watanabe