tags:

views:

23

answers:

1

I had originally created a set of array classes that allowed me to initialize the different arrays in the constructor. For example,

Vector A(2,0);

would create a vector of length 2 with each element being equal to zero.

For a number of reasons I've decided to pitch that class and go with something a little more commercial. I would like to change as little as possible in my existing code and I'm having problems with the constructors. In the new class, a 2 element vector would be initialized in the following manner:

Array A(2); A = 0;

What I would like to do is make it so that I can use my current constructors. I've been able to use my type names

template class Vector :public Array {};

So, now Vector A(2) create a 2 element vector but I can't figure out how to use Vector A(2,0) to initialize a 2 element vector.

Since the base class is from another source I would prefer to avoid accessing anything in the base class. I'm hoping this is possible and that someone has a solution. Thanks.

A: 

Sorry about that, the language is C++. It looks like my template line got mangled. It should be:

template < typename T > class Vector : public Array< T,1> {};

Not sure why I have to answer instead of commenting.

It looks like you're using another account... any reason?
Zack Mulgrew
I finally decided to sign-up. The hughgs is the actual account, the original question was from before I registered. Nothing nefarious, just timing. And since I can add a comment I guess that answers one of my questions.
OK, it looks like most of the code got mangled. Is there a way to delete this question and start again?