// nested.cpp: example of nested functions in C++ #include using namespace std; class nested { public: nested() { enum { base = 13 }; class Exp { private: int res; public: void compute(int power) { res = 1; for(int i = 0; i < power; ++i) res *= base; } int getRes() { return res; } }; Exp *vol = new Exp(); vol->compute(3); cout << "volume is " << vol->getRes() << endl; } }; int main() { nested n; return 0; }