Why this happening?
[code]
usernameType* theAccountType = theAccountUser.FactoryMethodCreate
(loginSession);
Human* theRealPosition = theAccountType->getInstance();
[/code]
theAccountType and theRealPosition are not in local and autos also.
Why this happening ?
Thanks for your help.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
It's always nice to start with which compiler, which debugger, which system.
> Why this happening?
>
> [code]
> usernameType* theAccountType = theAccountUser.FactoryMethodCreate
> (loginSession);
> Human* theRealPosition = theAccountType->getInstance();
>
> [/code]
>
> theAccountType and theRealPosition are not in local and autos also.
>
Since you are talking local and autos I will assume that you are using
*a* version of visual studio.
> Why this happening ?
>
Post a full code example. And especially provide information where your
debugger is currently stopped and what you *do* see in the autos and
local list.
Apart from that, this probably belongs to a Visual studio specific NG.
(try microsoft.public.vc.language or microsoft.public.vc.debugger)
br,
Martin
From the sound of your letter it sounds like you're using Visual
Studio to debug (locals and autos are two of the windows in
that product). Your question is better asked in a forum
having microsoft in it's name. Try hovering the mouse over
the variable name for a quick look or type the name in the
"watch" window.
If these variables are defined in a class or at namespace
(global) scope, they won't show up in locals because they
are not, and the compiler populates auto with it's idea of
what is important that may not coincide with yours.
Perhaps you should ask in a forum dedicated to your platform (from
below, I gather it's MSVS).
MSVS has many online support forums. How to use a specific tool is
not really on-topic here.
Please see FAQ 5.9
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
{ quoted sig & banner removed. don't quote extraneous material. tia., -mod }
OK, i post the main code here and the local and auto variable i see at
a specific break point.
[code]
int main()
{
SystemIntro staffPersonnelSystem;
staffPersonnelSystem();
login loginSession;
loginSession();
usernameType theAccountUser(loginSession);
usernameType* theAccountType = theAccountUser.FactoryMethodCreate
(loginSession);
[Break point here].
theAccountType->ForwardCreator();
MenuOption anOption(loginSession);
Human* theRealPosition = theAccountType->getInstance();
theRealPosition->CallBack(anOption() );
[/code]
Autos
loginSession
theAccountUser
Local
anOption
loginSession
theAccountUser
There are no error in return type of those calls.
{ quoted banner removed. please don't quote extraneous material. tia., -mod }
I think this issues is not related to compiler since i test it with a
simple program like this.
int number(10);
int* ptr = &number;
It eventually, i can check ptr in auto and local window.
Thanks.
I have class contains pointer to newly dynamic created object.
I set the pointer nicely but after return to main The pointer no
longer valid.
[code]
usernameType theAccountUser(loginSession);
usernameType* theAccountType(theAccountUser.FactoryMethodCreate
(loginSession));
theAccountType->ForwardCreator();
void AdministratorType::ForwardCreator()
{
// Forward call to AdminFactory
AdministratorObjectFactory adminFactoryObject;
setInstance(adminFactoryObject.createInstance());
}
// =========================================
void AdministratorType::setInstance(Human* myInstance)
{
theInstance = myInstance;
}
[/code]
theInstance is member of usernameType derived class.
theInstance is valid after the execution of setInstance() but invalid
in main.
Why this happening ?
> I think this issues is not related to compiler since i test it with a
> simple program like this.
>
> int number(10);
> int* ptr = &number;
>
> It eventually, i can check ptr in auto and local window.
The fact that you can't see something in your debugger is a toolset
issue. Use of your tools - in particular, your IDE and debugger - is
not related to the C++ language proper, and are better addressed in
a forum for your toolset.
Again, please see FAQ 5.9, for a list of suggested places where you
might get a better answer.
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9