HI All,
I need some help in creating and accessing vector.
I have a class...
Class CMyPage{
MyPage::MyPage(Cstring strfilename, LONGLONG liEditpoint):
m_filename(strfilename)
,m_liEdit(liEditpoint)
{
}
Get FileName(return m_filename;)
Get EditPoint(return liEdit;)
private:
CString m_filename;
LONGLONG m_liEdit;
};
I will be creating a vector of this class as I need to increase at run time.
Class 2{
private:
std::vector<CMyPage> vecMyPage;
local function{
CString filename = "dkljfdkfj";
LONGLONG ni = < some number>;
CMyPage mypage(filename, ni);
vecMyPage.pushback(mypage);
}
It all works fine when i call this function 2 times. If it's called more, then the previous value in the vector(only the CString) become null or some rubbish character. How do I make sure the value does not go out of scope?
Thanks for any help.
P.S: the code is there just to give an idea of what i am trying to do. Hope you appreciate that my question here is more logical or understanding the concept.