c_-c_templates:class_template
Differences
This shows you the differences between two versions of the page.
c_-c_templates:class_template [2017/10/12 11:29] – created peter | c_-c_templates:class_template [2017/10/12 15:16] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== C - C++ Templates - Class Template ====== | ||
- | |||
- | <code cpp> | ||
- | # | ||
- | using namespace std; | ||
- | |||
- | template< | ||
- | class test | ||
- | { | ||
- | R data; | ||
- | |||
- | public: | ||
- | void getdata(); | ||
- | void putdata(); | ||
- | }; | ||
- | |||
- | |||
- | template< | ||
- | void test< | ||
- | { | ||
- | cout<<" | ||
- | cin>> | ||
- | } | ||
- | |||
- | |||
- | template< | ||
- | void test< | ||
- | { | ||
- | cout<<" | ||
- | } | ||
- | |||
- | |||
- | int main() | ||
- | { | ||
- | test< | ||
- | test< | ||
- | t1.getdata(); | ||
- | t1.putdata(); | ||
- | t2.getdata(); | ||
- | t2.putdata(); | ||
- | | ||
- | return 0; | ||
- | } | ||
- | </ | ||
c_-c_templates/class_template.1507807773.txt.gz · Last modified: 2020/07/15 09:30 (external edit)