T
Thelma Roslyn Lubkin
I use vector and matrix classes that I developed before they were
otherwise easily available. They are template classes that should be
able to use objects of other classes I've developed, e.g.
matrix<myclass<double> > amatrix(2,2)
declares a 2x2 matrix of objects of type myclass<double>.
My constructor for a matrix sets its elements to 0
for(int i=0; i<ilen; i++)
for(int j=0; j<jlen;j++)
mx[j] = scalar(0);
Is there any way for me to overload that 'scalar(0)' so that it's
defined for the myclass elements of amatrix?
Otherwise, how do I get around this? Do I need another constructor
that simply doesn't initialize the matrix?
This is my first attempt to write a matrix populated by templated
objects and I'm sure that this is only the first of many problems
I'll get entangled in.
thanks for any help,
--thelma
otherwise easily available. They are template classes that should be
able to use objects of other classes I've developed, e.g.
matrix<myclass<double> > amatrix(2,2)
declares a 2x2 matrix of objects of type myclass<double>.
My constructor for a matrix sets its elements to 0
for(int i=0; i<ilen; i++)
for(int j=0; j<jlen;j++)
mx[j] = scalar(0);
Is there any way for me to overload that 'scalar(0)' so that it's
defined for the myclass elements of amatrix?
Otherwise, how do I get around this? Do I need another constructor
that simply doesn't initialize the matrix?
This is my first attempt to write a matrix populated by templated
objects and I'm sure that this is only the first of many problems
I'll get entangled in.
thanks for any help,
--thelma