Visual C++ .NET/Function/Function Return

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Return a Pointer from a Function

<source lang="csharp">

  1. include "stdafx.h"
  2. include <typeinfo.h>
  3. using <mscorlib.dll>

using namespace System; int *MyInteger() {

   int *res = new int;
   *res = 10;
   return res;

} int main(void) {

   int *x = MyInteger();
   delete x;
   return 0;

}

 </source>