#include class Base { public: Base():x_(0),y_(0){}; //インライン関数 Base(int _x,int _y):x_(_x),y_(_y){}; int x_; int y_; }; class Extend:public Base { public: Extend():Base(),z_(0){} Extend(int _x,int _y,int _z):Base(_x,_y),z_(_z){} int z_; }; using namespace std; int main() { Extend iExt(2,3,4); cout << "(x, y, z) = " << iExt.x_ << ", " << iExt.y_ << ", " << iExt.z_ << endl; Base iDown_casted = (Base)iExt; //アップキャスト cout << "(x, y, z) = " << iDown_casted.x_ << ", " << iDown_casted.y_ << ", " << iDown_casted.z_ << endl; }