sos \ Visual C ++ [英] sos\ visual C++
本文介绍了sos \ Visual C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在另一个类中使用NameDlg.h中标识的变量,但我不知道该怎么做.
我在Dlg.cpp文件中指向了"this"(!),但是我不能使用它.
我的代码在这里:
(CMynameDlg *)指针)-> My_variable
编译错误为:未声明的标识符"
请帮帮我!
:confused:
I wanna use a variable identified in NameDlg.h in another class and i dont know what i should do.
I made a pointer pointing to "this"(!) in Dlg.cpp file but i cant use it.
my code is here:
(CMynameDlg *)pointer)->My_variable
the compilation error is : "undeclared identifier"
Please help me!
:confused:
推荐答案
如果在NameDlg.h
中声明了变量 ,则必须在Dlg.cpp
中包含这样的头文件. br/> 但是,您实际上想做什么?您知道,您不应该直接公开变量,最好将变量访问器定义为某个类的公共方法.
:)
If your variable is declared inNameDlg.h
then you have to include such header file insideDlg.cpp
.
However, what do you want to do really? You know, you shouldn''t expose directly variables, it would be better to define variable accessors as public methods of a some class.
:)
这篇关于sos \ Visual C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文