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
General
3 years
23 Answers
491 views
0
Answers ( 23 )
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;
}
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;
}
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;
}
Sorry it a private answer.
Sorry it a private answer.
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
//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;
}
Md Mahbubur Rahman Khan
id-18192103150
#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;
}