////////////////////////////////////////
/// Base Structure
////////////////////////////////////////
struct baseStruct
{
public:
virtual baseStruct& operator [](string Str)
{
return *this;
}
};
////////////////////////////////////////
///Main class deriverd from BaseStruct
////////////////////////////////////////
__nogc class MainClass : public baseStruct
{
int IndexCount; /// loop count, 3 times rotate
/// if the operator is [][][]
string Str1; /// the three string arguments;
string Str2;
string Str3;
public:
baseStruct *DataPtr; // a pointer to Data Base struct
MainClass ()
{
IndexCount = 0;
Str1 = "";
Str2 = "";
Str3 = "";
}
virtual baseStruct& operator [](string Str)
{
if (IndexCount == 0)
{
IndexCount++;
Str1 = Str;
return *this;
} else if (IndexCount == 1)
{
IndexCount++;
Str2 = Str;
return *this;
} else if (IndexCount == 2)
{
Str3 = Str;
cout << Str1 << " " << Str2<< " " <<Str3<< endl;
IndexCount = 0;
Str1 = "";
Str2 = "";
Str3 = "";
return *DataPtr;
}
/*return *this;*/
}
};