Advertisement
Elygian

C++ CW

Nov 26th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class Person
  7. {
  8.  
  9. private:
  10.     string m_FirstName, m_LastName, m_telephone, m_email;
  11.  
  12. public:
  13.     Person(const string& firstName, const string& lastName) :
  14.         m_FirstName(firstName), m_LastName(lastName)
  15.     {}
  16.  
  17.     string get_name() const
  18.     {
  19.         return m_FirstName;
  20.     }
  21.     string get_surname() const
  22.     {
  23.         return m_LastName;
  24.     }
  25.  
  26.     bool has_telephone_p()
  27.     {
  28.         if (m_telephone == "")
  29.         {
  30.           return true;
  31.         }
  32.        
  33.         else
  34.         {
  35.           return false;
  36.         }
  37.     }
  38.  
  39.     bool has_email_p()
  40.     {
  41.  
  42.     }
  43. };
  44.  
  45.  
  46. int main()
  47. {
  48.     string f, l;
  49.  
  50.     cout << "Enter fist name: ";
  51.     cin >> f;
  52.     cout << "Enter Last name: ";
  53.     cin >> l;
  54.     Person p(f, l);
  55.     cout << p.get_name() << " " << p.get_surname() << endl;
  56.     cout << p.has_telephone_p() << endl;
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement