#include "stdafx.h"
using namespace System;
template <typename T>
public ref class CTemplate
{
T m_obj;
public:
CTemplate(T obj) { m_obj = obj; }
property T InnerObject
{
T get() { return m_obj; }
void set(T obj) { m_obj = obj; }
}
};
int main(){
CTemplate<int>^ ct_int;
CTemplate<String^>^ ct_string;
ct_int = gcnew CTemplate<int>(55);
ct_string = gcnew CTemplate<String^>("test");
Console::WriteLine("{0} ", ct_int->InnerObject );
Console::WriteLine("{0} ", ct_string->InnerObject );
}
|