What are the four functions that compiler automatically provides? How can you prevent compiler to provide automatically?
Latest Answer: 1) Default constructor 2) Copy constructor 3) Assignment operator 4) Destructor We can stop the compiler by providing the definition for all the four functions. ...
Compare Modular Structered Programming and Object Oriented Programming
Latest Answer: Modular programming promotes the separation of a program into components
called modules. Interfaces act as the logical boundaries between modules which
express elements that are provided and required by the module. All elements
defined within ...
Which of the following is an illegal cast based on this code snippet? struct B{operator int();};struct D: B{};B b;float const f = 0; A. static_cast(&b);B. static_cast(b);C. static_cast(b);D. static_cast(&f);E.
Latest Answer: They are all syntax error. The syntax isstatic_cast(expression)What is the target type of these casts? ...
What is the problem or error with the following code snippet and how would it be fixed?class Car { public: Car() { num = 1; } private: const int num;};A. You cannot change a const
Latest Answer: Using initialiser list is one way,and making the data num mutable is another ...
class ABC { public: ABC(int i = 0) { val = i;} int GetVal() {return val;} void SetVal(int i) {val = i;} private: int val;};void DoubleABC(ABC&
Latest Answer: There is no problem ...
Which of the following function name is legal in C++?A. $_foo()B. !_foo()C. 1_foo()D. -_foo()E. #_foo()
Latest Answer: void $_foo();Can be used as function name ...
To allow derived class functions to access private base class data, what should you do?A. You should use a private base class function.B. You should use a public or protected base class function.C. You
Latest Answer: F. None of the above are entirely the right answerYou can provide a method in the base class to allow the private data to be read or written and then provide an access specifier in the derived class which allows the methods to be called. For example:class ...
class ABC { public: ABC(int i = 0) { val = i;} int GetVal() {return val;} void SetVal(int i) {val = i;} private: int val;}void DoubleABC(ABC&
Latest Answer: The class has a missing semi-colon ';' following the closing brace. So the answer should be: E: None of the above ...
Which one of the following statements is FALSE?A. The access privileges in C++ are private, protected and public.B. The default access level assigned to members of a class is private.C. Public members
Latest Answer: Protected members are accessible by its sub-classes.Protected members are not acceble by its sub classes, as when they inherit base class protected variables of base class becomes private to sub class. So it can't access. ...
Hi I very recently did the C++ online Quiz and was surprised to find that my answer (1) to the following question (below) was incorrect. Is there something I am missing here, or is the answer incorrect.
Latest Answer: You can if the base class provides public or protected methods that modify its private data. Then derived class can expose this using access specifiers. ...
View page << Previous 1 2 [3] 4 5 6 7 8 9 10 Next >>

Go Top