hmm....why I can't get the output?? any wrong ?? thx for helping...
#include <iostream>
using namespace std;
const int SIZE = 3;
class Course {
string* students;
public:
Course (string* students);
~Course ();
void print();
};
Course::Course (string* students) {
students = new string[SIZE];
for(int i=0; i<SIZE; i++){
students[i]=Course.students[i];
}
}
Course::~Course() {
delete [] students;
}
void Course::print() {
cout << "Students = ";
for (int i = 0; i < SIZE; i++)
cout << students[i] << " ";
cout << endl;
}
int main() {
string s1[] = {"aaa", "bbb", "ccc"};
Course c1(s1);
c1.print();
string s2[] = {"xxx", "yyy", "zzz"};
Course c2(s2);
c2.print();
return 0;
}