![]() |
|
#1
|
|||
|
|||
Constructors and scope issueOk, well theres a lot of code to this problem so ill describe as best I can instead of showing 10 pages.
I have a container class MapCell Inside that class there are pointers to 2 other classes CharBase and TerBase. All 3 classes are derived from CRect (doubt thats relevant) I am trying to manage memory completely from within the container class. Heres the members from MapCell that might be relevant to the problem: (It might be better to skip this block of code and look at the next before coming back) CPP / C++ / C Code:
So thats generally how the copying / construction / destruction is handled but now when I go to populate a 2d vector of these MapCells I have some big problems. CPP / C++ / C Code:
I am not sure if I am just not populating the vector properly, or my construction / copy / destruction is wrong. Any help appreciated, thanks. |
|
#2
|
|||
|
|||
Re: constructors and scope issueOk so I changed the way I am populating the vector.
CPP / C++ / C Code:
And now it appears to be working fine. Is it that pushback makes a deep copy , but = is shallow ? |
|
#3
|
|||
|
|||
Re: constructors and scope issueQuote:
I didn't look at your code, though, but if you tested it's working now, then the assignment operator is most likely the cause. __________________
Music, programming, endless learning.. |
|
#4
|
|||
|
|||
Re: constructors and scope issueOk, thanks for the info !
|
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing constructors of a base class explicitly in the derived class | nethravathi.mn | CPP / C++ Forum | 1 | 27-Sep-2006 17:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The