/*
 * exampleStep4Inheritance.cpp
 * 
 * Author: Deborah R. Fowler
 * Date: Oct 19, 2019
 * 
 * Simple example to show inhertitance and access levels
 */


#include <iostream>
#include <string>
using namespace std;

class Phone
{
    public:
        string provider;
    private:
        void communicate();
    public:
        Phone();
        ~Phone();
};

Phone::Phone()
{
    cout << "\nA phone has been created!";
    provider = "Verizon";
}

Phone::~Phone()
{
    cout << "\nHang up";
    
}

void Phone::communicate()
{
    cout << "\nTalk, talk, talk";
};

class Mobile: public Phone
{
    public:
        int batterylife;
        void charge();
        Mobile();
};

Mobile::Mobile()
{
    provider = "Sprint";
}

void Mobile::charge()
{
    cout << "\nCharging phone";
}

class Landline: public Phone
{
    public:
        string location;
};

int main()
{
        Phone *pPhone = new Phone;
        // This will give an error because communicate is private
        // pPhone->communicate();
        cout << pPhone->provider;
    
        
        Mobile *pMobile = new Mobile;
        cout << pMobile->provider;
        
        delete(pPhone);
        delete(pMobile);
}


