Good evening!
So I've been trying to get my head around these classes and it's not going well.
From what I've understand I've been calling functions correctly, but for some reason the members I'm creating are not being accepted.
class TheData
{
public:
void InputData();
void DisplayMembers();
TheData();
~TheData();
protected:
double* Values;
int Length;
bool Valid;
};
TheData::TheData()
{
Valid = false;
Length = 0;
Values = 0;
TheMenu::MainMenu(); //Don't think that's right but dunno how else to call it
}
void TheMenu::MainMenu()
{
cout << "Menu" << endl;
cout << "-----------" << endl;
cout << "1. Enter data for filtering" << endl;
cout << "2. Enter filter values" << endl;
cout << "3. Apply filter" << endl;
char UserInput;
cout << "Enter your option: ";
cin >> UserInput;
cout << endl;
switch(UserInput) {
case '1':
DataIn.InputData(); //That's the error
DataOut.SendMembers(1,"false",0,0);
break;
...
int main()
{
TheData DataIn;
return 0;
}
task2.cpp(73) : error C2065: 'DataIn' : undeclared identifier
So in summary what I understand that I've done is created an object of type class TheData in main(), and yet other functions don't accept that it exists. I thought that because main() doesn't end yet, all the members and variables that were created inside it would still be available to all the other functions in the program.
Kind regards,
Ed