Skip to content

Instantly share code, notes, and snippets.

@drewverlee
Created November 16, 2012 17:45
Show Gist options
  • Save drewverlee/4089348 to your computer and use it in GitHub Desktop.
Save drewverlee/4089348 to your computer and use it in GitHub Desktop.
personType.cpp|86 col 5 error| type ‘personType’ is not a direct base of ‘docterType’$
#include <iostream>
#include <string>
using namespace std;
class personType
{
public:
void print() const;
//Function to output the first name and last name
//in the form firstName lastName.
void setName(string first, string last);
//Function to set firstName and lastName according
//to the parameters.
//Postcondition: firstName = first; lastName = last;
string getFirstName() const;
//Function to return the first name.
//Postcondition: The value of firstName is returned.
string getLastName() const;
//Function to return the last name.
//Postcondition: The value of lastName is returned.
personType(string first = "", string last = "");
personType();
//Constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are null strings.
//Postcondition: firstName = first; lastName = last;
string firstName; //variable to store the first name
string lastName; //variable to store the last name
};
void personType::print() const
{
cout << firstName << " " << lastName;
}
void personType::setName(string first, string last)
{
firstName = first;
lastName = last;
}
string personType::getFirstName() const
{
return firstName;
}
string personType::getLastName() const
{
return lastName;
}
//constructor
personType::personType(string first, string last)
{
firstName = first;
lastName = last;
}
class docterType
{
/* -----------------$$( Constructor )$$-----------------*/
docterType(string ilast, string ifirst, string ispecility);
docterType();
/* -----------------$$( datamembers )$$-----------------*/
string specility;
};
docterType::docterType(string ilast, string ifirst, string ispecility) :
personType(ifirst, ilast)
{
specility = ispecility;
}
int main()
{
personType drew("drew","deer");
drew.print();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment