#include <iostream>

using namespace std;

class A{
public:
    int x, y, z;

    A() {
        this->x = 0;
        this->y = 0;
        this->z = 0;
    }
    
    ~A() { }

    void init (int x_in, int y_in, int z_in){
        this->x = x_in;
        this->y = y_in;
        this->z = z_in;
    }

    int sum(){
        return this->x + this->y + this->z;
    }

    void show_result() {
        int result = sum();
        cout << "sum = " << result << endl;
    }
};


enum { A_CAR, A_CAT, A_CANADA, A_NUM };

class B {
public:
    A A_arr[A_NUM];

    B() {
        A_arr[A_CAR].init(0, 1, 2);
        A_arr[A_CAT].init(1, 2, 3);
        A_arr[A_CANADA].init(8, 7, 6);
    }
    
    ~B() {}
    
    void show_all_result() {
        for (int i = 0; i < A_NUM; i++) {
        	A_arr[i].show_result();
        }
    }
};


int main() { 

    B obj_B;

    obj_B.show_all_result();
}
