class Name {
public:
Name();
~Name();
Name(string CustomerName, string CustomerlastName);
string setFirstName(string CustomerName);
string setLastName(string CustomerlastName);
string getFirstName() const;
string getLastName() const;
private:
string firstName;
string lastName;
};
class Person { //Class declaration
public: //Public Members
~Person(); //destructor
Person(); //default constructor
Person(Name cName, Adress cAdress, string cPersonnummer, int cSkonummer); //Constructor call with values
void setCusmoterNamn(Name const & cName); //Set function Customer name
void setCustomerAdress(Adress const & cAdress); //set function for Adress
void setCustomerPersonNummer(string customerpersonNummer); //set function for Customer perosnal number
void setCustomerSkoNummer(int customerskoNummer); //set function for Customer Shoe number
Name getCusmoterNamn() const; //get function for customer Name
Adress getCusmoterAdress() const; //Get function for customer family name
string getCustomerPersonNummer(); //get function for Personal Number
int getCustomerSkoNummer(); //get funktion for Sko nummer
private: //Private class memebers
Name namn; // Object of type Name
Adress adress; // Object of type Adress
string persNr; // variable of type String
int skoNr; //Variable of type int
};
void PrintPersonObject(vector <Person> &Personer){ //This is used for printing complete class Person
for (std::vector<Person>::iterator it = Personer.begin(); it != Personer.end(); ++it) {
cout << "Name :" //<< it->getCusmoterNamn();// CustomerName() is returning a object i.e Name, I dont knw how to return a string to be able to print.
}
}
jeudi 26 février 2015
How to return a string by a getfunction which return an object only
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire