Answer Posted / achal
In C++ there are 2 kinds of templates. i) function
templates ii) Class templates.
Among these class templates are more common.
e.g.
template <class T > class Sample
{
public:
T m1;
void fun(T);
};
Now here we have created a class which has a data member of
type T. Now this T can be int, unsigned int, char etc.
Thus templates are said to be used for generic programming.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include What are structures and unions? What is a type library? What is istream c++? What is the difference between a baller and a reference in C++? Explain about Garbage Collector? How is new() different from malloc()? Difference between pointer to constant and constant pointer to a constant. Give example. Which operator cannot be overloaded c++? total amount of milk produced each morning and then calculates
and outputs the number of cartons needed for this milk , the
cost of producing the milk and the profit from producing this
milk. Who created c++? What is the most useful programming language? What are the advantages of c++ over c? How are Structure passing and returning implemented by the compiler? Explain the static member function.