I am new to C++ and working on a project where I have array of instances of a class, and within that class I have a struct that within that I have a function. How do I use that function within my main code block. I tried
class artwork {
struct art {
// the struct art contains important information such as artist, title and medium.
private:
string artist;
public:
void setArtist(string values);
string getArtist();
};
void artwork::art::setArtist(string values) {
artist = values;
}
int main (){
artwork myartwork[500];
for (int i = 0; i < 500; i++) {
///-----------------------------------
///-----------------------------------
// below is where the error occurs? How do I reference setArtist?
///-----------------------------------
///-----------------------------------
cout << myartwork[0].art.setArtist("Tim");
}
system("pause");
return 0;
}