English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-10-04 04:13:33 · 3 answers · asked by kikrfik l 1 in Computers & Internet Programming & Design

3 answers

I cannot say it better than the creator of C++, Bjarne Stroustrup,

"A class template specifies how a class can be generated given a suitable set of template arguments. Similarly, a function template specifies how a function can be generated given a suitable set of template arguments. Thus, a template can be used to generate types and executable code. With this expressive power comes some complexity. Most of this complexity relates to the variety of contexts involved in the definition and use of templates."

2006-10-08 01:13:55 · answer #1 · answered by Mark aka jack573 7 · 0 0

A Templated class is an empty class definition that you can compile without error. Check out this example

class TemplateClass
{
public:
x=0;
y=1;
TemplateMethod();

private:
int x; //Data member
int y; // Data member
};

2006-10-04 15:13:10 · answer #2 · answered by gilberts55 3 · 0 0

sample: (MyClass)

template
class MyClass
{
public:
X Method1();
private:
X member1;
};

there's a lot of information about templates in MSDN for inst.

2006-10-04 11:25:08 · answer #3 · answered by Ugi 2 · 0 0

fedest.com, questions and answers