![]()
typedef class
{ public:
char m_name[24];
int m_ten1;
int m_ten2;
} Str1;
typedef class
{ public:
int m_ten1;
int m_ten2;
int m_ten3;
int m_ten4;
} Str2;
Str1 str1 = { "愛知 真唯子", 80, 90 };
Str2 str2 = { 53, 64, 75, 86 };
|
template<class Type>
int Sum(Type* str)
{
return str->m_ten1+str->m_ten2;
}
|
printf("str1 Sum=%d\n",Sum(&str1));
printf("str2 Sum=%d\n",Sum(&str2));
|
![]()