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 the following program execute?

0 Answers  


What is abstraction c++?

0 Answers  


How many ways can a variable be initialized into in C++?

0 Answers   HCL,


What is the basic structure of c++ program?

0 Answers  


When a function is made inline. Write the situation where inline functions may not work.

2 Answers  






write a program in c++ to generate imp z y x w v w x y z z y x w x y z z y x y z z y z z

4 Answers  


What is a stack c++?

0 Answers  


What is public, protected, private in c++?

0 Answers  


What is the use of seekg in c++?

0 Answers  


To which numbering system can the binary number 1101100100111100 be easily converted to?

0 Answers  


What are punctuators in c++?

0 Answers  


In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest.

5 Answers   GE,


Categories