class Foo {
const int x;
protected:
Foo(int f);
~Foo();
};
Foo f;
Referring to the sample code above, why will the class
declaration not compile?
a) The variable x is const.
b) The destructor is protected.
c) The destructor is not public.
d) The constructor is protected.
e) There is no default constructor.

Answers were Sorted based on User's Feedback



class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referri..

Answer / guest

There is no default Constructor

Is This Answer Correct ?    11 Yes 3 No

class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referri..

Answer / alphare

a, d, e

Is This Answer Correct ?    2 Yes 1 No

class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referri..

Answer / guest

a

Is This Answer Correct ?    2 Yes 4 No

class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referri..

Answer / gopinath das

a,b,c,d

Is This Answer Correct ?    1 Yes 4 No

class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referri..

Answer / sampurna pandey

a,b,c,e

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C++ General Interview Questions

Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

0 Answers  


What is a Default constructor?

1 Answers  


Can a program run without main?

0 Answers  


What is volatile and pragma? When they are used?

1 Answers  


What are the different data types present in C++?

1 Answers  






Find out the bug in this code,because of that this code will not compile....... #include <iostream> #include <new> #include <cstring> using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout << "Destructing "; cout << name << "\n"; } void set(double n, char *s) { cur_bal = n; strcpy(name, s); } void get_bal(double &n, char *s) { n = cur_bal; strcpy(s, name); } }; int main() { balance *p; char s[80]; double n; int i; try { p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; }

2 Answers   Impetus,


Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

0 Answers   Nucleus, TCS,


Is swift faster than c++?

0 Answers  


What is an incomplete type in c++?

0 Answers  


How do you clear a set in c++?

0 Answers  


Write a program to calculate the following i want a c++program for this condition 1+4+9+16+….+100 Like this (1^2+2^2) Hint use function pow(a,b)

4 Answers   HTC, TCS,


What does it mean to declare a member function as virtual?

0 Answers  


Categories