Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class type2 {
- public:
- int a, b;
- type2(int a, int b): a(a), b(b) { }
- };
- class type1 {
- public:
- int ab;
- type1(int ab): ab(ab) { }
- type1(type2 t) {
- ab = t.a * t.b;
- }
- };
- int main() {
- type2 t2(3, 4);
- cout << t2.a << " " << t2.b << endl;
- cout << ((type1)t2).ab << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement