This project is maintained by abrarShariar
View On Github


This header file deifnes the class SMS : public PhoneCall

Brief Description:

- Creates new Text Message or SMS

- Saves all the SMS sent by any particular Phone

- Inherits [public] the class PhoneCall

Data Members [private]

  • string text
  • double textCost
  • static double textRate
  • static double textLimit

  • Member Functions [public]

  • SMS(string textNumber,string textContent)   [parameterize constructor]
  • void setText(string text)
  • string getText()
  • double getTextCost()
  • double getAvgCallLength()
  • int getTextLength()

  • Static Members [static]

  • void setTextRate(double rate)
  • void setTextLimit(int textLimit)

  • Code

        this file contains the SMS class which inherits PhoneCall
    #include "PhoneCall.h"
    using namespace std;
    class SMS:public PhoneCall{
            string text;
            double textCost;
            static double textRate;
            static int textLimit;
            SMS(string textNumber,string textContent):PhoneCall(textNumber){
            void setText(string text);
            static void setTextRate(double rate);
            static void setTextLimit(int textLimit);
            string getText();
            double getTextCost();
            int getTextLength();
            static double getTextRate();
            static int getTextLimit();
    int SMS::textLimit=0;
    double SMS::textRate=0;
    void SMS::setText(string text){
    void SMS::setTextRate(double rate){
    void SMS::setTextLimit(int limit){
    string SMS::getText(){
        return this->text;
    double SMS::getTextCost(){
        int charCount=this->text.length();
        return charCount*this->textRate;
    double SMS::getTextRate(){
        return textRate;
    int SMS::getTextLimit(){
        return textLimit;
    int SMS::getTextLength(){
        string s1=this->getText();
        return s1.length();
    int main(){
        string text,textNum;
        cout << "Enter recepient: ";
        cout <<"Enter Text: \t ";
        SMS s1(textNum,text);
        cout<< endl;
        cout<< s1.getStartDate()<< endl;
        cout<< s1.getStartTime()<< endl;
        cout<< s1.getText()<< endl;
        cout<< s1.getTextCost()<< endl;
        cout<< s1.getCallNumber()<< endl;