#include<iostream.h> class CuriousTab { int *p; public: CuriousTab(int xx, char ch) { p = new int(); *p = xx + int(ch); cout<< *p; } ~CuriousTab() { delete p; } }; int main() { CuriousTab objCuriousTab(10, 'B'); return 0; }
#include<iostream.h> struct MyData { public: int Addition(int a, int b = 10) { return (a *= b + 2); } float Addition(int a, float b); }; int main() { MyData data; cout<<data.Addition(1)<<" "; cout<<data.Addition(3, 4); return 0; }
#include<iostream.h> class CuriousTab { int x; public: CuriousTab() { x = 0; } CuriousTab(int xx) { x = xx; } CuriousTab(CuriousTab &objB) { x = objB.x; } void Display() { cout<< x << " "; } }; int main() { CuriousTab objA(25); CuriousTab objB(objA); CuriousTab objC = objA; objA.Display(); objB.Display(); objC.Display(); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.