Object Oriented Programming Practice (Intake 41)

Question

Create an abstract class called Phone. Phone will have only one function called callReceive(). Create a derived class called Landline and Mobile where Landline will define callReceive() so that it will show output “pick up” and similarly Mobile will show the output “press receive”.In main function use Phone class in a way that shows all the outputs.

in progress 0
Ask me anything 2 weeks 22 Answers 142 views 0

Answers ( 22 )

  1. name:Md.Emon ALi
    id:154
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"<callReceive();
    mobile e;
    p=&e;
    p->callReceive();
    return 0;

    }

  2. Name: Rakibul Hasan Shafin
    ID: 18192103165
    Intake: 41
    Section:04
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  3. ID- 8192103180

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callreceive() {};
    };
    class landline : public phone
    {
    public:
    void callreceive()
    {
    cout << "pick up"<<endl;
    }
    };
    class mobile : public phone
    {
    public:
    void callreceive()
    {
    cout << "press receive "<callreceive();
    p = &ob1;
    p->callreceive();
    return 0;
    }

  4. Sorry it a private answer.

  5. Sorry it a private answer.

  6. Name:Tabassum Mehrin Prova
    ID:177
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"<callReceive();
    mobile e;
    p=&e;
    p->callReceive();
    return 0;

    }

  7. Name: Tamanna Tasnim
    ID:142

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  8. Name :Jahinur islam
    Id: 169

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  9. ID- 136
    Name:sabila Rahman
    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callreceive() {};
    };
    class landline : public phone
    {
    public:
    void callreceive()
    {
    cout << "pick up"<<endl;
    }
    };
    class mobile : public phone
    {
    public:
    void callreceive()
    {
    cout << "press receive "callreceive();
    return 0;
    }

  10. name:Shaminur Rahman
    id:158
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  11. Name:Sanjara
    ID:166
    Section:4

    #include
    using namespace std;

    class landline{

    public:
    char x;
    void A()
    {
    cout<<"PICK UP"<<x<<endl;
    }
    };
    class mobile{

    public:
    char y;
    void B()
    {
    cout<<"PRESS RECEIVE"<<y<<endl;
    }
    };
    class phone:public landline,public mobile{
    public:
    void callreceive(){}
    };
    int main()
    {
    phone obj1;
    obj1.A();
    obj1.B();
    obj1.callreceive();

    return 0;
    }

  12. Name: Md. Mintu Hossain
    ID: 17181103110

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {

    }

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Press receive"<callReceive();

    mobile m;
    ob=&m;
    ob->callReceive();

    return 0;
    }

  13. ID:18192103139
    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callreceive() {};
    };
    class landline : public phone
    {
    public:
    void callreceive()
    {
    cout << "pick up"<<endl;
    }
    };
    class mobile : public phone
    {
    public:
    void callreceive()
    {
    cout << "press receive "callreceive();
    return 0;
    }

  14. Asfack uddin nabil
    Id-173
    Sec -4

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {

    }

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();

    return 0;
    }

  15. Name: Rois Uddin Khan Emon
    Intake:41
    Sec: 4
    ID: 18192103153

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {

    }

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();

    return 0;
    }

  16. Name: Nigar Sultana Era
    Id: 175
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"<callReceive();
    mobile e;
    p=&e;
    p->callReceive();
    return 0;

    }

  17. Name: MD Tayeb
    Intake: 41
    Sec: 4
    ID: 18192103164

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  18. D.k.Shah Alam
    id:18192103 176
    sec-4

    #include
    using namespace std;
    class phone{
    public:
    virtual void callreceive()=0;
    };
    class landline:public phone{
    public:
    void callreceive(){
    cout<<"Pick up"<<endl;
    }
    };
    class mobile: public phone{
    public:
    void callreceive(){
    cout<<"Press Receive"<callreceive();

    mobile ob22;
    b=&ob22;
    b->callreceive();
    return 0;
    }

  19. Name :Arup Raton Chowdhury
    Id: 155

    #include
    using namespace std;
    class phone
    {
    public:
    virtual void callReceive()
    {}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;

    }

  20. name:Md Ashraful Hossain
    id:137
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}
    };
    class landline:public phone
    {
    public:
    void callReceive()
    {
    cout<<"Pick up"<<endl;
    }
    };
    class mobile:public phone{
    public:
    void callReceive()
    {
    cout<<"Press receive"callReceive();
    return 0;
    }

  21. Name:Arman Hossain
    Id:18192103156
    #include
    using namespace std;
    class phone{
    public:
    virtual void callreceive()=0;
    };
    class landline:public phone{
    public:
    void callreceive(){
    cout<<"Pick up"<<endl;
    }
    };
    class mobile: public phone{
    public:
    void callreceive(){
    cout<<"Press Receive"callreceive();
    return 0;
    }

  22. //Name: Syeda Nafia Sultana, ID: 17181103058, Intake: 37
    #include
    using namespace std;
    class phone{
    public:
    virtual void callReceive(){}

    };
    class landline:public phone
    {
    public:
    void callReceive()
    {cout<<"Pick up"<<endl;}
    };
    class mobile:public phone
    {
    public:
    void callReceive()
    {cout<<"Press receive"<callReceive();
    mobile m;
    p=&m;
    p->callReceive();
    return 0;
    }

Leave an answer