This Small pice of code this is rum in VS2003 but not in VS2008
result on VS 2003 :- call the constructor.
i got this error on VS 2008 "error C2248: 'CVoice::getdata' : cannot access private member declared in class 'CVoice'"
How to reslove this Issue ?
#include "stdafx.h"
using namespace std;
class CMobileVoice;
class CVoice
{
private:
int a;
int getdata();
public:
CVoice()
{
getdata();
std::cout<<"constructor";
a=10;
}
};
int CVoice::getdata()
{
return 100;
}
class CMobileVoice
{
public:
friend int CVoice::getdata();
};
int _tmain(int argc, _TCHAR* argv[])
{
CVoice a;
getch();
return 0;
}