#include<iostream.h> class Base { int x, y, z; public: Base() { x = y = z = 0; } Base(int xx, int yy = 'A', int zz = 'B') { x = xx; y = x + yy; z = x + y; } void Display(void) { cout<< x << " " << y << " " << z << endl; } }; class Derived : public Base { int x, y; public: Derived(int xx = 65, int yy = 66) : Base(xx, yy) { y = xx; x = yy; } void Display(void) { cout<< x << " " << y << " "; Display(); } }; int main() { Derived objD; objD.Display(); return 0; }
#include<iostream.h> class CuriousTabSample { private: int AdditionOne(int x, int y = 1) { return x * y; } public: int AdditionTwo(int x, int y = 1) { return x / y; } }; int main() { CuriousTabSample objCuriousTab; cout<<objCuriousTab.AdditionOne(4, 8)<<" "; cout<<objCuriousTab.AdditionTwo(8, 8); return 0; }
Copyright ©CuriousTab. All rights reserved.