//Person.h
#ifndef PERSON_H
#define PERSON_H
#include<string>
class Person
{
private:
static const int LIMIT = 25;
std::string lname;
char fname[LIMIT];
public:
Person() { lname = "", fname[0] = '\0'; }
Person(const std::string& ln, const char* fn = "Heyyou");
void Show()const;
void FormalShow()const;
};
#endif // !PERSON_H
//Person.cpp
#include<iostream>
#include<string>
#include<cstring>
#include "Person.h"
Person::Person(const std::string& ln, const char* fn)
{
lname = ln;
std::strcpy(fname, fn);
}
void Person::Show()const
{
std::cout << fname << '-' << lname << '\n';
}
void Person::FormalShow()const
{
std::cout << lname << "-" << fname << '\n';
}
//program.cpp
#include<iostream>
#include"Person.h"
int main()
{
Person one;
Person two("Smythecraft");
Person three("Dimwiddy", "Sam");
one.Show();
two.FormalShow();
three.FormalShow();
return 0;
}