what is the use of template classes in c++
Answer / ags
Templates are used to avoid the repetition of similar
functions in any class.
| Is This Answer Correct ? | 6 Yes | 0 No |
why overriding?
what are the realtime excercises in C++?
What is the real time example of encapsulation?
Can destructor be overloaded?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What do we mean by a hidden argument in a function?
//what is wrong with the programme?? #include<iostream.h> template <class first> class dd { first i; public: void set(); void print(); }; void dd< first>:: set() { cin>>i; } void dd< first>::print() { cout<<"\n"<<i; } void main() { dd <char>g; g.set(); g.print(); }
suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?
What is new keyword in oops?
WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE
Does c++ support multilevel and multiple inheritance?
The type of variable a pointer points to must be the part of pointer's definition so that: