I'm getting a "IntelliSense no default constructor exists for class "Person" line 71." Also am getting error c2512: 'Person:' no appropriate default constructor available...
There is a constructor there which confuses me on why I'm getting an error?
#include <iostream>
#include <string>
using namespace std;
class Bio
{
public:
Bio();
Bio(string name, string street, string city, string state, string postalcode);
void print() const;
private:
string name, street, city, state, postalcode;
};
Bio::Bio(){name = street = city = state = postalcode = "";}
Bio::Bio(string aName, string aStreet, string aState, string aCity, string aPostalCode)
{ name = aName, street = aStreet; state = aState; city = aCity; postalcode = aPostalCode; }
void Bio::print() const
{
cout << name << " : " << street << " : " << state << " : " << city << " : " << postalcode << endl;
}
class Person
{
public:
Person(Bio &); // constructor
void getBio(Bio &) const;
void setBio(Bio &);
virtual void print() const; //print derived classes
virtual string getTitle() const = 0;
private:
Bio bio;
};
Person::Person(Bio &z)
{
bio = z;
}
void Person::getBio(Bio &a) const
{
a = bio;
}
void Person::setBio(Bio &a)
{
bio = a;
}
void Person::print() const
{
bio.print();
}
class Student : public Person
{
public:
Student (Bio &bio, float gpa);
void print() const;
float getGPA() const;
void setGPA (float);
string getTitle() const;
private:
float gpa;
};
Student::Student(Bio &bio, float gpa)
{
bio = bio;
gpa = gpa;
}
void Student::print() const
{
cout << "Student starts out : Student bio for";
}
float Student::getGPA() const
{
return gpa;
}
void Student::setGPA(float aGPA)
{
gpa = aGPA;
}
string Student::getTitle() const
{
}
int main()
{
cout <<"Creating Bio object for John Smith" << endl;
Bio j ("John Smith", "123 Main St.", "Chicago", "IL", "12345");
j.print();
cout <<"Changed bio for prof object." << endl;
Bio n("Nana Liu", " 3000 N. Campbell Ave", "Chicago", "IL", "60618");
n.print();
//Person john(j);
return 0;
}