yeah - like so:kuniklo wrote: Ironically the whole point of C++ is that it allows you to keep on writing a = b + c for types the compiler implementer never dreamed of.
Code: Select all
// library code:
template<class T>
class Complex
{
public:
T re, im;
// ...define operators
};
template<class T>
class Matrix
{
public:
T **data;
int numRows, numColumns;
// ...define operators
};
// client code:
Matrix< Complex<double> > a, b, c; // matrices with double-precision
// complex elements
// assign b, c
a = b + c;..or is there a way to do this C that i may have overlooked?
OK - this was a little off-topic. my conclusion: C++ can sometimes be ugly, but is also very powerful. but C can be just as ugly, as well.
