-1

GeoSheet というクラスがあります。

#include "stdafx.h"
#include "GeoSheet.h"

namespace A {
    int isClosable; 
    double x; 
}

void CGeoSheet::OnOK()  
{
    A::isClosable = 0;
    CPropertySheet::OnClose();
}

test.cpp という別のファイルから変数 'isClosable' にアクセスして変更したい

#include "stdafx.h"
#include "test.h"
#include "GeoSheet.h"

void main(){
    //access variable
}

どうすればこれを達成できますか。GeoSheet のインスタンスをインスタンス化せずに変数にアクセスしたい。
ありがとう。

4

1 に答える 1

0

isClosableどのクラスにも属していません。これは、名前空間に置かれた単なるグローバル変数です。クラスメソッド内で使用したのと同じ方法でメインで使用できますが、違いはありません。

于 2013-10-17T06:27:07.723 に答える