![]() |
|
#1
|
||||
|
||||
|
1) Fill in the blanks below with public, protected or private keyword.
a. Public members of base class are __________ members of derived class b. Protected members of base class are __________members of derived class. Q2) Can a constructor throw an exception? How to handle the error when the constructor fails? Q3) What is the difference (if any) between the two types of function declarations? template function_declaration; template function_declaration; Q4) State any two reasons why the virtual methods can not be static? Q5) Give three advantages that Iterators provide over Cursors. Q6) Consider the code given below explain what kind of association exists between class A and class B. Justify your answer as well. class A{ private: int a,b,c; public: …. }; class B{ private: int d,e,f; A obj1; public: …. }; Q7) If we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class. Q8) Is it possible to have Virtual Constructor? Justify your answer. Q9) Explain the difference between static member variables with Non-static member variables of a class with the help of example. Q10) There are some errors in the code given below, you have to 1. Indicate the line no. with error/s 2. Give the reason for error/s 3. Correct the error/s. 1. #include (header extension is missing 2. #include 3. using namespace std; 4. template 5. class MyClass{ 6. public: 7. MyClass(){ 8. cout"This is class1"endl; 9. } 10. }; 11. template 12. class MyClass{ 13. public: 14. MyClass(){ 15. cout"This is class2"endl; 16. } 17. }; 18. int main(int argc, char *argv[]) 19. { 20. MyClass c1; 21. MyClass c2; 22. system("PAUSE"); 23. return 0; } Q11) What is a container class? What are the types of container classes? Q12) What is a Virtual Destructor? Why we use Virtual Destructors. |
![]() |
















Linear Mode


