|
-
February 17th, 2003, 06:04 AM
#1
Initializing valarray and inheritence
Hi there I am pretty new to C++ object-orientated stuff and I was wondering if you could help. I have a class called Equations with a protected variable declared as:
valarray<double> myParameters;
I want to initialise this to a certain size during the constructor of the inherited class Model1. In the constructor I have:
valarray <double> myParameters(13);
myParameters[1]=2;
In another function of the Model1 class I have:
cout << myParameters[1] << endl;
But when this function is run it does not print "2" but some random amount. I concluded that i must be initialising it wrong.
Any ideas how to inherite a valarray object and initialise it to a certain size in the inherited class.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|