Click here to Skip to main content
15,928,207 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: comminute screen Pin
Shog912-Apr-02 17:09
sitebuilderShog912-Apr-02 17:09 
GeneralRe: comminute screen Pin
Nish Nishant12-Apr-02 17:41
sitebuilderNish Nishant12-Apr-02 17:41 
GeneralRe: comminute screen Pin
Shog912-Apr-02 17:53
sitebuilderShog912-Apr-02 17:53 
GeneralRe: comminute screen Pin
Nish Nishant12-Apr-02 17:42
sitebuilderNish Nishant12-Apr-02 17:42 
GeneralMulti subitem selection Tree control Pin
Wolfram Steinke12-Apr-02 15:23
Wolfram Steinke12-Apr-02 15:23 
GeneralRe: Multi subitem selection Tree control Pin
wangyiming12-Apr-02 17:21
wangyiming12-Apr-02 17:21 
QuestionBest price for Visual Studio.net upgrade? Pin
CodeProjectSQ12-Apr-02 14:45
CodeProjectSQ12-Apr-02 14:45 
GeneralModifying CDocument Member Objects :: MFC Pin
valikac12-Apr-02 13:57
valikac12-Apr-02 13:57 
Is there a unique MFC protection that keeps an object to another class from modifying its private data?

I have a CStringArray in the my document class (single-document). I pass the CStringArray object to class function belonging to another object that I instantiate inside of the document class.

For example:

#include myOutsideClass;

void CMyClassDoc::change()
{
myOutsideClass *pClass = new myOutsideClass;
pClass->modify(myCStringArrayObject);
}

-----
// Definition of modify()

void CMyOutsideClass(CStringArray &array)
{
array.RemoveAll(); // remove all data from object array
array.Add("testing"); // insert "testing" into object array
}
-----

Notice I pass the CStringArray object into modify using reference. Function modify(CStringArray &array) can read data from the object array. However, it cannot make permanent changes such as RemoveAll(), Add(), and/or SetAt().

Is there a internal protection algorithm that keeps another object from making permanent changes to a member object? I tried declaring the CStringArray inside of CDocument in public. That does not work either. The program crashes with an *access violation* error.

Thanks,
Kuphryn
GeneralRe: Modifying CDocument Member Objects :: MFC Pin
wangyiming12-Apr-02 17:08
wangyiming12-Apr-02 17:08 
GeneralRe: Modifying CDocument Member Objects :: MFC Pin
valikac12-Apr-02 18:18
valikac12-Apr-02 18:18 
GeneralRe: Modifying CDocument Member Objects :: MFC Pin
wangyiming12-Apr-02 19:33
wangyiming12-Apr-02 19:33 
GeneralRe: Modifying CDocument Member Objects :: MFC Pin
valikac12-Apr-02 19:53
valikac12-Apr-02 19:53 
GeneralRe: Modifying CDocument Member Objects :: MFC Pin
valikac15-Apr-02 5:02
valikac15-Apr-02 5:02 
GeneralFull Screen Windows Pin
Waleed Eissa12-Apr-02 12:46
Waleed Eissa12-Apr-02 12:46 
GeneralRe: Full Screen Windows Pin
Christian Graus12-Apr-02 12:49
protectorChristian Graus12-Apr-02 12:49 
GeneralRe: Full Screen Windows Pin
Rickard Andersson2012-Apr-02 21:45
Rickard Andersson2012-Apr-02 21:45 
GeneralRe: Full Screen Windows Pin
Christian Graus12-Apr-02 21:45
protectorChristian Graus12-Apr-02 21:45 
GeneralRe: Full Screen Windows Pin
PJ Arends12-Apr-02 14:16
professionalPJ Arends12-Apr-02 14:16 
GeneralRe: Full Screen Windows Pin
Waleed Eissa13-Apr-02 0:09
Waleed Eissa13-Apr-02 0:09 
GeneralCComboBox Question Pin
User 988512-Apr-02 12:37
User 988512-Apr-02 12:37 
GeneralCComboBox Question Pin
User 988512-Apr-02 13:18
User 988512-Apr-02 13:18 
GeneralRe: CComboBox Question Pin
Nish Nishant12-Apr-02 17:30
sitebuilderNish Nishant12-Apr-02 17:30 
GeneralRe: CComboBox Question Pin
Shog912-Apr-02 17:15
sitebuilderShog912-Apr-02 17:15 
GeneralMessage handler crashing only in release mode Pin
Jack Handy12-Apr-02 11:17
Jack Handy12-Apr-02 11:17 
GeneralRe: Message handler crashing only in release mode Pin
Chris Losinger12-Apr-02 11:30
professionalChris Losinger12-Apr-02 11:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.