Is it possible to inherit identically named operator which only differ in return type, from two different abstract classes. If so, them:
what is the syntax for implementing operators
what is the syntax for using/resolving operators
what is the overhead in general case, same as for any other virtual function?
if you can provide me with a reference or sample code that would be helpful
thanks
12struct abstract_matrix {
13 virtual double& operator()(int i, int j);
14};
15
16 struct abstract_block_matrix {
17 virtual double* operator()(int i, int j);
18 };
19
20struct block_matrix : abstract_matrix, abstract_block_matrix {
21
22};
block matrix needs to provide implementations for both operators, so that it is either a matrix or a block matrix, depending on the context. I do not know how to provide implementation specific to block_matrix class. right now, it is done by passing object wrapped type as the last argument, but that does not seem very clean. I would like to retain pure matrix notation.