Question: Class definitions (interfaces) are stored in a header file, a file with the suffix .h Create the class definition for the Person class in file
Class definitions (interfaces) are stored in a header file, a file with the suffix .h
Create the class definition for the Person class in file Person.h as follows:
#ifndef PERSON_H #define PERSON_H #includeusing namespace std; class Person { public: Person(); Person(string fname, string lname, string cname); string getFirstName(); string getName(); string getLastName(); string getCompany(); private: string firstname; string lastname; string company; }; // Person #endif
The methods (member functions) of a class are stored in a file with the same name but with the suffix .cpp.
Complete the member function definitions in the file Person.cpp below. This file should begin with:
#include "Person.h" #includeusing namespace std; Person::Person() { firstname = ""; lastname = ""; company = ""; } // constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
