{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Cpp 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 터를 저장하고 얻어오는 템플릿 클래스 정의하기 IT COOKBOOK 13[예제 13-4] 13_4.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 #include <iostream> using namespace std; template <typename DATATYPE> class Test{ DATATYPE value; public : Test(DATATYPE v); DATATYPE void SetValue(DATATYPE v); DATATYPE DATATYPE GetValue(); }; template <typename DATATYPE> Test<DATATYPE> <DATATYPE>::Test(DATATYPE v) <DATATYPE> DATATYPE { value = v; } template <typename DATATYPE> void Test<DATATYPE> <DATATYPE>::SetValue(DATATYPE v) <DATATYPE> DATATYPE { value = v; - 11 } [실습하기 13-4] 데이터를 저장하고 얻어오는 템플릿 클래스 정의하기 IT COOKBOOK 13[예제 13-4] 13_4.cpp 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 template <typename DATATYPE> <DATATYPE>::GetValue() DATATYPE Test<DATATYPE> <DATATYPE> { return value; } void main() { Test<int> obj1(10); <int> obj1.SetValue(10); cout<<obj1.GetValue()<<endl; Test<double> obj2(5.7); <double> cout<<obj2.GetValue()<<endl; } - 12 - [실습하기 13-5] 자...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern