M
Milan
How do I write a class with "optional" interface like the following one:
class A
{
:
// inteface_a
// interface_b
};
void main()
{
A obj_a(interface_a); // define an object with interface a
A obj_b(interface_a | interface_b); // define an object with
interface a AND b
obj_b.func_b(); // calling function defined in interface
b; OK
obj_a.func_b(); // calling function not defined in
interface a; Compilation error
}
--
Can I write something like this in C++? Thanks.
Regards,
Milan.
class A
{
:
// inteface_a
// interface_b
};
void main()
{
A obj_a(interface_a); // define an object with interface a
A obj_b(interface_a | interface_b); // define an object with
interface a AND b
obj_b.func_b(); // calling function defined in interface
b; OK
obj_a.func_b(); // calling function not defined in
interface a; Compilation error
}
--
Can I write something like this in C++? Thanks.
Regards,
Milan.