473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing variables...

hi all,

I have a question in reference to accessing variables in another class maybe
someone has dealt with before.
I have some public variables declared in my main plug-in class
CCommandMeshToSrf,
eg: BOOL m_bHaveAnswer;
I want to set this variable from within a dialog class which is defined in
separate .h and .cpp files of course. How would one access this varibale
from a method defined in my CTestModelessDialog class ?

I had this working in a previous version by declaring a pointer to the main
plug-in
class:
CCommandMeshToSrf *m_cmd; and then accessing the public vairable in the
CTestModelessDialog class by using:

m_cmd->m_bHaveAnswer

Recently, it shows up as an undefined variable and crashes....any ideas
?

thanks,

jurek


Jan 27 '07 #1
2 2327
In article <32******************@newssvr12.news.prodigy.net >,
"Jurek Dabrowski" <da*****@sbcglobal.netwrote:
hi all,

I have a question in reference to accessing variables in another class maybe
someone has dealt with before.
I have some public variables declared in my main plug-in class
CCommandMeshToSrf,
eg: BOOL m_bHaveAnswer;
I want to set this variable from within a dialog class which is defined in
separate .h and .cpp files of course. How would one access this varibale
from a method defined in my CTestModelessDialog class ?

I had this working in a previous version by declaring a pointer to the main
plug-in
class:
CCommandMeshToSrf *m_cmd; and then accessing the public vairable in the
CTestModelessDialog class by using:

m_cmd->m_bHaveAnswer

Recently, it shows up as an undefined variable and crashes....any ideas
?
Did you initialize it?
Jan 27 '07 #2
"Jurek Dabrowski" <da*****@sbcglobal.netwrote in message
news:32******************@newssvr12.news.prodigy.n et...
hi all,

I have a question in reference to accessing variables in another class
maybe
someone has dealt with before.
I have some public variables declared in my main plug-in class
CCommandMeshToSrf,
eg: BOOL m_bHaveAnswer;
I want to set this variable from within a dialog class which is defined in
separate .h and .cpp files of course. How would one access this varibale
from a method defined in my CTestModelessDialog class ?

I had this working in a previous version by declaring a pointer to the
main
plug-in
class:
CCommandMeshToSrf *m_cmd; and then accessing the public vairable in the
CTestModelessDialog class by using:

m_cmd->m_bHaveAnswer

Recently, it shows up as an undefined variable and crashes....any ideas
?

thanks,

jurek
"Recently, it shows up as an undefined varaible and crashes..." That is an
oxymoron. If it is an undefined variable, it won't compile. I has to
compile to crash, and if it compiles it's not an undefined variable.

If it fails to compile (link error) then most likely you forgot to include
the header file (.h) in the other .cpp file.

If it crashes, then maybe it's not initialized.

The normal way is to pass a pointer, or better yet, a reference.

Please show code and the actual error/crash if this doesn't help.
Jan 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Earl Teigrob | last post by:
I am programming ASP.NET using C#. I have been accessing static variables accross my entire application but now need to change some of the static variables that are session specific to instance...
3
by: Alex | last post by:
I'm having a problem porting an ASP solution to ASPX. In the ASP solution I'm accessing a DCOM server, create sub DCOM objects and call functions from VB script on the ASP pages. The DCOM object...
9
by: Bob Day | last post by:
VS 2003, vb.net , sql msde... I have an application with multiple threads running. Its a telephony application where each thread represents a telephone line. For code that would be the same...
1
by: Nathan | last post by:
Hi, I have created a class library creating a number of forms and a few public variables. I have a project that references the .dll for this class library, and in that project I need to access...
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
5
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
5
by: TS | last post by:
is it preferred to access member variables directly in code, on the page that declared them, versus going thru a property accessor? I would think that since theres no security concerns or anything...
12
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
6
kaarthikeyapreyan
by: kaarthikeyapreyan | last post by:
Is there any possibility that i could access a the variables that i have defined in a function for example def foo(): i = 10 i = i + 10 I would like to retrieve the value and use it in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.