Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- class ContactInfo {
- private:
- char* name;
- char* phone;
- public:
- ContactInfo(char* n, char* p)
- {
- name = new char[strlen(n) + 1];
- phone = new char[strlen(p) + 1];
- int size = strlen(n) + 1;
- strcpy(name, n);
- strcpy(phone, p);
- }
- ~ContactInfo()
- {
- delete[] name;
- delete[] phone;
- }
- const char* getName() const
- {
- return name;
- }
- const char* getPhoneNumber() const
- {
- return phone;
- }
- };
- int main()
- {
- ContactInfo entry("kristin lee", "951-199-9999");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement