// This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using // Common RunTime Library #include #include #include "unmanaged.h" #include "managed.h" using namespace System; // This is the entry point for this application #ifdef _UNICODE int wmain(void) #else int main(void) #endif { Console::Write(S"\n Hello from Console::Write"); std::wcout << L"\n Hello from iostream::wcout"; std::wstring msg1 = L"\n unmanaged class generated by wizard"; msg1 += L"\n created on main's stack frame"; UnManaged unMan(msg1); std::wcout << unMan.show().c_str(); std::wstring msg2 = L"\n unmanaged class generated by wizard"; msg2 += L"\n created on unmanaged heap"; UnManaged *punMan = new UnManaged(msg2); std::wcout << punMan->show().c_str(); delete punMan; String &msg3 = *new String("\n managed class created on managed heap"); Managed &Man = *new Managed(msg3); Console::Write(&Man.show()); // don't call delete - garbage collector takes care of that std::wcout << L"\n\n"; return 0; }