I have tried to create a simple class where the program passes a name and telephone number to my class type and then prints it to the screen. It tells me I have undeclared identifiers, but I am constructing my program just like an example we did in class. Can someone tell me what I am doing wrong?!
// Specification file (Time.h)
// This file gives the specification
//of a phone abstract data type
#include <iostream>
#include <string>
class Phone
{
public:
void Set(string firstName, string lastName, int number);
void Write() const;
Phone(string initfName, string initlName, int initNum);
Phone();
private:
string fName;
string lName;
int Num;
};
//Implementation file (phone.cpp)
#include "Phone.h"
#include <iostream>
#include <string>
using namespace std;
void Phone::Set(string firstName, string lastName, int number)
{
fName = firstName;
lName = lastName;
Num = number;
}
void Phone::Write() const
{
cout << fName;
cout << lName << endl;
cout << Num;
}
Phone::Phone(string initfName, string initlName, int initNum)
{
fName = initfName;
lName = initlName;
Num = initNum;
}
Phone::Phone()
{
fName = "";
lName = "";
Num = 0;
}
#include "Phone.h"
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
int main()
{
Phone thePhone(Andrew, Daniel, 4906996);
thePhone.write();
cout << endl << endl;
system("pause");
return 0;
}