?
=?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=
Lets say we have some interfaces declared:
class A { virtual void a() = 0; };
class B { virtual void b() = 0; };
class C { virtual void c() = 0; };
We also have some classes implementing none or some of these
interfaces. Now I think it would be neat if I could define a function
that will accept an object that implemts both interface A and B as
input. Something like this:
void AcceptAAndB(/* parameter type */);
This funtion should accept the following classes:
class AB : public A, public B { };
class ABC : public A, public B, public C { };
The function should not accepts arguments of the following classes:
class JustA : public A { };
class JustB : public B { };
As far as I can see there is no easy way of doing this in C++. But I
would really like to be able to do it. =)
Has anyone around here been trying to do something like this? Any
ideas or thoughts along these lines?
Regards,
Mattias
class A { virtual void a() = 0; };
class B { virtual void b() = 0; };
class C { virtual void c() = 0; };
We also have some classes implementing none or some of these
interfaces. Now I think it would be neat if I could define a function
that will accept an object that implemts both interface A and B as
input. Something like this:
void AcceptAAndB(/* parameter type */);
This funtion should accept the following classes:
class AB : public A, public B { };
class ABC : public A, public B, public C { };
The function should not accepts arguments of the following classes:
class JustA : public A { };
class JustB : public B { };
As far as I can see there is no easy way of doing this in C++. But I
would really like to be able to do it. =)
Has anyone around here been trying to do something like this? Any
ideas or thoughts along these lines?
Regards,
Mattias