C++ Programming :: Constructors and Destructors
-
p>What will be the output of the following program?
#include<iostream.h> class FresherGate { int x; public: FresherGate(int xx, float yy) { cout<< char(yy); } }; int main() { FresherGate *p = new FresherGate(35, 99.50f); return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { public: Freshergate() { cout"Fresher"; } ~Freshergate() { cout"GATE"; } }; int main() { Freshergate objGATE; return 0; } -
Which of the following statement is correct about the program given below?
#include class GATE { int x; public: GATE(); ~GATE(); void Show() const; }; GATE:GATE() { x = 25; } void GATE::Show() const { coutint main() { GATE objB; objB.Show(); return 0; } -
Which of the following statement is correct about the program given below?
#include class GATE { int x; public: GATE(); void Show() const; ~GATE(){} }; GATE::GATE() { x = 5; } void GATE::Show() const { coutint main() { GATE objB; objB.Show(); return 0; } -
#includeint val = 0; class Freshergate { public: Freshergate() { cout -
Which of the following constructor is used in the program given below?
#include class Freshergate { int x, y; public: FresherGATE(int xx = 10, int yy = 20 ) { x = xx; y = yy; } void Display() { cout" " int main() { Freshergate objGATE; objGATE.Display(); return 0; } -
What will be the output of the following program?
#include class Freshergate { public: GATEBase() { cout"Base OK. "; } }; class GATEDerived: public GATEBase { public: GATEDerived() { cout"Derived OK. "; } ~BixDerived() { cout"Derived DEL. "; } }; int main() { GATEBase objB; GATEDerived objD; objD.~GATEDerived(); return 0; } -
What will be the output of the following program?
#include class Freshergate { int x, y; public: Freshergate(int xx) { x = ++xx; } ~Freshergate() { cout1 " "; } void Display() { cout1 " "; } }; int main() { Freshergate objGate(5); objGate.Display(); int *p = (int*) &objGate; *p = 40; objGate.Display(); return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { int x; public: FresherGate(short ss) { cout"Short" int xx) { cout"Int"(char ch){ cout"Char" cout"Final"; } }; int main() { FresherGate *ptr = new FresherGate('B'); return 0; } -
Which of the following statement is correct about the program given below?
#include class FresherGate { int x; public: FresherGate(short ss) { cout"Short" int xx) { cout"Int" float ff) { cout"Float" cout"Final"; } }; int main() { FresherGate *ptr = new FresherGate('B'); return 0; }

Whatsapp
Facebook