J
Jerry Krinock
I've declared a class that has some std::vector data members like this:
class MyClass
{
public:
...
std::vector<Apples> apples ;
...
private:
...
std::vector<Oranges> oranges ;
...
}
This program often crashes when I call on my "apples" or "oranges".
Now, I was thinking that maybe the problem is that I declare the instance of
MyClass using "new", so it is on the heap, but I do not use "new" when
declaring the apples and oranges; they look like they are on the stack, yet
they are a member of something which is on the heap. I'm not sure where
they are!
Is there something inherently wrong with the above declaration?
THANKS!
Jerry Krinock
San Jose, CA USA
class MyClass
{
public:
...
std::vector<Apples> apples ;
...
private:
...
std::vector<Oranges> oranges ;
...
}
This program often crashes when I call on my "apples" or "oranges".
Now, I was thinking that maybe the problem is that I declare the instance of
MyClass using "new", so it is on the heap, but I do not use "new" when
declaring the apples and oranges; they look like they are on the stack, yet
they are a member of something which is on the heap. I'm not sure where
they are!
Is there something inherently wrong with the above declaration?
THANKS!
Jerry Krinock
San Jose, CA USA