Ugh, error 2664 -- please help

I really am beginning to think this lab is going to kill me or drive me mad.

I had a boatload of errors and was able to clear most of them up. One y'all helped me with last night. One more I can't figure out:


this is the lab2class.cpp

#include <string>
#include "ACourse.h"
#include "AStudent.h"
#include "ATeacher.h"
#include "pch.h"
#include <iostream>

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);

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();


}

here is the ACourse.cpp:

#include "ACourse.h"
#include "pch.h"
#include <iostream>
#include "AStudent.h"
#include "ATeacher.h"

ACourse::ACourse()
{
}

ACourse::ACourse(AStudent, AStudent, AStudent, ATeacher, std::string className)
{


aClassName = className;
}


ACourse::~ACourse()
{
}

void ACourse::SetClassName(std::string className)
{
this->aClassName = className;
}

std::string ACourse::GetClassName()
{
return this->aClassName;
}


And last but not least, the ACourse.h file:

#pragma once
#include <string>
#include "AStudent.h"
#include "ATeacher.h"

class ACourse
{
public:
std::string aClassName;

ACourse();
ACourse(AStudent, AStudent, AStudent, ATeacher, std::string className);

~ACourse();

void SetClassName(std::string className);
std::string GetClassName();
};



Thank you so much for the help.
Last edited on
closed account (SECMoG1T)
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();
}
Insufficient information.

You haven't posted astudent.h or ateacher.h.
You also haven't posted the errors you're receiving.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Yolanda, you are my hero. Honestly.
Topic archived. No new replies allowed.