I have a dummy question for you...
I am trying to access a function from a class (Key) from another class (Music), but it gives the error:
‘thiskey’ was not declared in this scope
So I guess the Key object thiskey is not public for this class.
What I have (stripped down, I left out some loops and a lot of functionality for readability, so I am sorry if the code does not actually do much):
Key thiskey();
int main( int argc, char **argv )
{
char keyid='A';
Key thiskey (keyid);
Music music1(1);
music1.feasible;
}
class Music{
char keyid;
public:
//variables
int id;
int music[20];
//functions
Music(int id);
bool feasible();
};
Music::Music(int id){
music[2]=thiskey.display; //this is the error line
}
}
class Key{
public:
//variables
int keylength;
int keyset[12];
//functions
void display();
};
Key::Key(char keyid){
keylength=12;
//keyset array is generated here
}
void Key::display(){
cout << "\nKey output:";
cout << keyset[1];
//for (int i=0; i<keylength; i++){
// cout << keyset[i];
//}
}
Many thanks for any suggestions! Do I need to use a scope? Of do I define this wrong?