I have a structure declared in header and implemented in source. Source file can perform on my struct variable, but my main can't see it. Why ?
A.hpp
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
class A {
public:
struct myStruct {
int someInt;
} myStructVar;
void loadA();
};
A.cpp
#include "stdafx.h"
#include "A.h"
void A::loadA() {
myStructVar.someInt = 10;
std::cout << myStructVar.someInt << std::endl; // 10 OK
}
Main.cpp
#include "stdafx.h"
#include "A.h"
int _tmain(int argc, _TCHAR* argv[])
{
A a;
a.loadA();
std::cout << myStructVar.someInt() << std::endl; // Error: identifier "myStructVar" is undefined
system("PAUSE");
return 0;
}
Error is is Main.cpp
Error: identifier "myStructVar" is undefined.
Thanks.