C++ facilitates generic programming through the use of templates.
Template metaprogramming is the broader concept of templates because they allow the computation of code at compile time. In other words, the compiler writes the program for you, creating and manipulating classes and functions to suit your needs according to the templates that define them and the specific types, values and templates you provide as arguments. Thus we can think of templates as being generators (as in code generators).
Generic programming usually begins with a concrete type which we then generalise through a template. This technique is known as "lifting". The concrete type may be a class or a function (including member functions). Once lifted, we can pass instances of that type to function templates that accept the template as an argument.
A function template is often called an algorithm which is a procedure or formula for solving a problem using a series of finite computational steps to produce a result. An algorithm is generic insofar as the data it operates upon need not be of a specific type, provided the generic type has the specific characteristics or traits that are appropriate to the algorithm.
Although template programming can result in a lot of code duplication, this is not the same as writing duplicate code by hand. Code duplication is a necessary evil, but compilers are much better at dealing with it than humans. When we duplicate code by hand, we increase the maintenance. Every time we alter the implementation we must make the same changes across all duplicates. This can easily lead to inconsistencies and program errors. By allowing the compiler to handle the duplication, we only have one implementation to worry about.
As a trivial example, consider the concrete examples for the max function overload:
int max (int a, int b) { return a<b?b:a; }
double max (double a, double b) { return a<b?b:a; }
While these function overloads are undoubtedly useful (returning the larger of two values), we can easily see that the implementation is exactly the same regardless of the type. Indeed, such a function is capable of handling any type that supports the less-than operator (<). Therefore rather than duplicating this code to cater for the myriad different types we could possibly pass to max (and including thousands upon thousands of headers that we may or may not need in any of our actual programs), it makes more sense for the compiler to generate the overloads for us, according to the types we actually pass to the function. In this way we not only cater for the types we actually use, we can also cater for types that do not yet exist!
In this case, the only argument we need to parametrise is the typename because both the arguments and the return value are of the same type. Thus we'll denote the typename with the token T:
T max (const T a, const T b) { return a<b?b:a; }
As it stands, the compiler will now look for a declaration of type T and won't find one. However, T is not a type it is a typename token. Therefore we must inform the compiler of that fact:
template<typename T> T max (T a, T b) { return a<b?b:a; }
Now that the compiler is appeased, it is time to look at the implementation in more detail. The first thing to note is that the function does not modify either of its arguments, so it makes sense to declare them both const.
template<typename T> T max (const T a, const T b) { return a<b?b:a; }
While this is fine for primitive data types or any type that fits the word length of the underlying architecture, passing by value is not so efficient when it comes to passing larger and more complex objects. Therefore we should pass by reference to avoid the penalty of making unnecessary automatic copies:
template<typename T> T max (const T& a, const T& b) { return a<b?b:a; }
Finally, we note that we always return the value of either a or b. But since we passed them both by reference it makes sense to return by reference rather than to return a temporary value (incurring another unnecessary copy). In C++11 this is less of a problem because most classes now implement move semantics, however we cannot guarantee this is always the case, so let's err on the side of caution:
template<typename T> T& max (const T& a, const T& b) { return a<b?b:a; }
We could also return the value as a constant reference but in my experience this only serves to confuse. Let the caller decide whether the return should be const or not, our function is only concerned with which argument is the greater.
At this point it is important to note that no code is actually generated by this function. When the compiler encounters a function template, it knows that it is merely a template and not an actual function. It will take note that the function template exists and cache its definition, however code can only be generated from a function template when we provide the function with an actual type, which we can only do by invoking the function:
int x=42, y=69;
// ...
int a = max (x, y);
Upon encountering this call, the compiler will generate the actual function for us:
int& max (const int& a, const int& b) { return a<b?b:a; }
However, even a half-decent compiler will recognise the golden opportunity for inline expansion and will eliminate the function call entirely:
int x=42, y=69;
// ...
int a = x<y?y:x;
The only caveat with templates is that the template must be completely visible to the compiler before it is used in code. Unlike ordinary types and functions, it is not enough that it merely be declared (as in a forward declaration), it must be fully defined as well. Thus you will often find template definitions in the same header as its declarations, and that same header included at the top of every source file that invokes the template.
As mentioned near the top of this article, templates naturally incur code duplication which is a necessary evil but one that is tamed through templates. The compiler will only generate code for the types you actually use but with the massive scope of compile-time computation and inline expansion, your code will be leaner, meaner and much more easily maintained than if you did it all by hand.
We've only scratched the surface of what is possible with templates. The best way to learn about generic programming is to make use of the generic types that already exist, particularly those in the standard template library (STL). You can learn a lot simply by examining the source code for these types.
Generic programming means that the code is generic enough that it compile on any C++ implementation. That is, it has no platform-specific code.
C++ uses the generic function implicitly whenever the base class implementation (the generic method) is also the most-derived implementation.
Objects in Dev C++ are the same as objects in generic C++, insofar as an object is an instance of a class.
It has no use in C++ itself, it is only useful in Borland Turbo C++. It provides generic graphics support for Borland Turbo C++ applications.
Neither C nor C++ provide any built-in methods to reproduce audio. They are generic languages; audio is hardware-specific. To play audio, you need an audio library suitable for your hardware. OpenAL is the generic audio library equivalent of OpenGL for graphics.
3D Studio Max is a modelling and rendering package. C++ is a generic programming language. You cannot export from one to the other.
This is not a C++ question. This is a library/platform question. Each configuration is different, so the generic answer is to look for a sockets or networking API.
C++ has no generic graphics methods whatsoever. All graphics are platform-specific and therefore require a suitable API and library to support your specific platform and hardware. Thus there is no generic C++ code for 2D animation let alone 3D animation.
Bjarne Stroustrup, who began development of the language, originally called C with Classes, in 1978. The name was changed to C++ in 1983. The first generic release appeared in 1985.
On Windows, Visual Studio is by far the best IDE, but the C++ implementation is not standards-compliant. For a more generic/portable solution, consider using gcc instead.
The C standard library IO facilities are not extensible. For instance, the printf() and scanf() functions cannot handle user-defined types. However, the C++ standard library provides IO streams with insertion and extraction operators (<< and >>) that can be overloaded to support any user-defined type.
Fore that you will need a library that supports the platform(s) you wish to target. Dialog is reasonably generic, but it is written in C rather than C++.