मैं एक वर्ग व्यक्ति कहा जाता है:IntelliSense: क्वालिफायर कि सदस्य समारोह साथ संगत नहीं हैं टाइप वस्तु है
void print() const {
for (int i=0; i< nPlayers; i++)
cout << "#" << i << ": " << people[i].getScore()//people is an array of person objects
<< " " << people[i].getName() << endl;
}
यह वह जगह है:
class Person {
string name;
long score;
public:
Person(string name="", long score=0);
void setName(string name);
void setScore(long score);
string getName();
long getScore();
};
अन्य वर्ग में, मैं इस विधि का उपयोग लोगों की घोषणा:
static const int size=8;
Person people[size];
जब मैं कोशिश यह संकलित करने के लिए मैं इस त्रुटि मिलती है:
IntelliSense: the object has type qualifiers that are not compatible with the member function
प्रिंट विधि
क्या मैं गलत कर रहा हूँ में के तहत 2 लोग [i] लाल लाइनों के साथ
?
'लोगों' की परिभाषा क्या है? क्या इसमें कहीं भी 'कॉन्स' क्वालीफायर हैं? –