/* personType header */
using namespace std;
#ifndef PERSONTYPE_H
#define PERSONTYPE_H
class personType{
private:
string firstName;
string lastName;
public:
void print()const;
void setName(string,string);
string getFirstName()const;
string getLastName()const;
personType(string first = "", string last = "");//default constructor
};
#endif
________________________________________________________________________________
/* person class implement cpp */
#include <string>
#include <iostream>
#include "personType.h"
using namespace std;
void personType::print()const{
cout << firstName << " " << lastName << endl;
}
void personType::setName(string first, string last){
firstName = first;
lastName = last;
}
string personType::getFirstName()const{
return firstName;
}
string personType::getLastName()const{
return lastName;
}
personType::personType(string first,string last){
p = Null;
firstName = first;
lastName = last;
}
Now should I do something like a struct inside the class? then just use the pointers in the personType cpp to cout the results?
private:
string firstName;
string lastName;
struct node{
node *link;
*head
{//end of struct node
public:
//just generic code really for basic idea.
Or would struct be used sort of like a prototype in the since it goes before the header as such
struct Node{
string firstName, lastName;
node *link
*head
};//end struct
class personType{
public:
personType();
private:
//whatever here
}; //end personType class
Am I sort of on the right track? Just looking for a push in the right direction please...tired and confused a bit. Thanks to all, regards.
(singly linked list btw)

New Topic/Question
Reply




MultiQuote






|