#include <iostream>
using namespace std;
class M {
protected:
int m;
public:
void set_m(int x) { m = x; };
};
class N {
protected:
int n;
public:
void set_n(int y) { n = y; };
};
class P : public M, public N {
public:
void display() { cout << m * n << endl; };
};
int main(){
int a, b;
cin >> a >> b;
P p;
p.M::set_m(a);
p.N::set_n(b);
p.display ();
return 0;
} // End of main()
Thanks
Happy Computing !
using namespace std;
class M {
protected:
int m;
public:
void set_m(int x) { m = x; };
};
class N {
protected:
int n;
public:
void set_n(int y) { n = y; };
};
class P : public M, public N {
public:
void display() { cout << m * n << endl; };
};
int main(){
int a, b;
cin >> a >> b;
P p;
p.M::set_m(a);
p.N::set_n(b);
p.display ();
return 0;
} // End of main()
Thanks
Happy Computing !
No comments:
Post a Comment