Re: Initialing member variable from another object ( class ) ...
I think, too, that if SetVariable were called AFTER a call to InitVariable, then SetVariable should have to check and possibly delete the previous allocated contents, else there'd be a memory leak.
Actually, the same applies to InitVariable. There's nothing that prevents either from being called multiple times.
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
Re: Initialing member variable from another object ( class ) ...
As Arjay and JVene have pointed out, the code that I have shown is VERY CRUDE and should be modified to include fairly extensive error checking. I debated whether or not to simply post the code or post it with many suggestions and decided to take things one step at a time, and hence the simple code.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.