Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- class speaker1_int;
- class speaker2_int;
- class speaker1_int{
- public:
- virtual void como_estas(speaker2_int* spk2)=0;
- virtual void Hola(speaker2_int* spk2)=0;
- };
- class speaker2_int{
- public:
- virtual void mucho_gusto(speaker1_int* spk1)=0;
- virtual void bien_y_vos()=0;
- virtual void start(speaker1_int* spk1)=0;
- };
- class speaker1: public speaker1_int{
- private:
- void Hola(speaker2_int* spk2){
- cout << "Hola!" <<endl;
- spk2->mucho_gusto(this);
- }
- void como_estas(speaker2_int* spk2){
- cout << "Como estas?" << endl;
- spk2->bien_y_vos();
- }
- };
- class speaker2: public speaker2_int{
- private:
- void mucho_gusto(speaker1_int* spk1){
- cout << "Mucho gusto" <<endl;
- spk1->como_estas(this);
- }
- void bien_y_vos(){
- cout << "Bien y vos?" <<endl;
- }
- public:
- void start(speaker1_int* spk1){
- spk1->Hola(this);
- }
- };
- int main (){
- speaker1* spk1;
- speaker2* spk2;
- spk1 = new (speaker1);
- spk2 = new (speaker2);
- spk2->start(spk1);
- delete spk1;
- delete spk2;
- return EXIT_SUCCESS;
- }
Add Comment
Please, Sign In to add comment