1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
int main()
{
AStudent *student1 = new AStudent("Jim", "Smith", 19, "123 Main Street", "Portland", 5034475588);
AStudent *student2 = new AStudent("Jane", "Blow", 22, "321 South Street", "Lawrenceville", 6785551234);
AStudent *student3 = new AStudent("Barry", "Long", 28, "456 North Avenue", "Palm Coast", 3865553547);
ATeacher *teacher1 = new ATeacher("Jessica", "Tandy", 86, "789 West Boulevard", "McAllen", 4055559864);
///yea acourse takes objects not pointers to such objects, you need to dereference them
ACourse *class1 = new ACourse(*student1, *student2, *student3, *teacher1, "Intermediate C++"); ///<error c2664 :'ACourse::ACourse(const ACourse &)': cannot convert argument 1 from 'AStudent *' to 'AStudent'>
std::cout << "The name of this course is " << class1->GetClassName() << std::endl;
student1->SitInClass();
teacher1->GradeStudent();
}
///if you have no reason to use pointters you are better off without them
int main()
{
AStudent student1("Jim", "Smith", 19, "123 Main Street", "Portland", 5034475588);
AStudent student2("Jane", "Blow", 22, "321 South Street", "Lawrenceville", 6785551234);
AStudent student3("Barry", "Long", 28, "456 North Avenue", "Palm Coast", 3865553547);
ATeacher teacher1("Jessica", "Tandy", 86, "789 West Boulevard", "McAllen", 4055559864);
ACourse class1(student1, student2, student3, teacher1, "Intermediate C++");
std::cout << "The name of this course is " << class1.GetClassName() << std::endl;
student1.SitInClass();
teacher1.GradeStudent();
}
|