M
major_tom3
I have a class derived from an abstract base class, which is in turn
derived from a further ABC:
template< typename T > class CAbstractMatrix{...};
template< typename T > class CAbstractSquareMatrix: public
CAbstractMatrix< T >{...};
template< typename T > class CDiagonalMatrix : public
CAbstractSquareMatrix< T >{...};
Can anyone tell me why this constructor initialiser:
template< typename T > CDiagonalMatrix< T >::CDiagonalMatrix( unsigned
long nRows, T* pData, bool bAdopt = false )
: CAbstractSquareMatrix< T >( pData, nRows, bAdopt ) // works
{
...
}
calls CAbstractSquareMatrix< T >::CAbstractSquareMatrix( unsigned long,
T*, bool) as intended, but the latter:
bAdopt = false )
: CAbstractMatrix< T >( pData, nSize, bAdopt ) // doesn't work!
{
...
}
fails to call CAbstractMatrix< T >::CAbstractMatrix( T*, unsigned long,
bool) in its turn? Everything compiles fine; don't be put off by my
changing the order of the parameters between classes. The code fails at
run-time because the base-base-class's constructor is not called.
Thanks,
tom
derived from a further ABC:
template< typename T > class CAbstractMatrix{...};
template< typename T > class CAbstractSquareMatrix: public
CAbstractMatrix< T >{...};
template< typename T > class CDiagonalMatrix : public
CAbstractSquareMatrix< T >{...};
Can anyone tell me why this constructor initialiser:
template< typename T > CDiagonalMatrix< T >::CDiagonalMatrix( unsigned
long nRows, T* pData, bool bAdopt = false )
: CAbstractSquareMatrix< T >( pData, nRows, bAdopt ) // works
{
...
}
calls CAbstractSquareMatrix< T >::CAbstractSquareMatrix( unsigned long,
T*, bool) as intended, but the latter:
template said:::CAbstractSquareMatrix( T* pData, unsigned long nSize, bool
bAdopt = false )
: CAbstractMatrix< T >( pData, nSize, bAdopt ) // doesn't work!
{
...
}
fails to call CAbstractMatrix< T >::CAbstractMatrix( T*, unsigned long,
bool) in its turn? Everything compiles fine; don't be put off by my
changing the order of the parameters between classes. The code fails at
run-time because the base-base-class's constructor is not called.
Thanks,
tom