<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Visual_C%2B%2B_.NET%2FLanguage_Basics%2Fgcnew</id>
		<title>Visual C++ .NET/Language Basics/gcnew - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Visual_C%2B%2B_.NET%2FLanguage_Basics%2Fgcnew"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Language_Basics/gcnew&amp;action=history"/>
		<updated>2026-04-29T20:22:04Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Language_Basics/gcnew&amp;diff=3832&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Language_Basics/gcnew&amp;diff=3832&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:02Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Language_Basics/gcnew&amp;diff=3833&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Language_Basics/gcnew&amp;diff=3833&amp;oldid=prev"/>
				<updated>2010-05-26T12:06:15Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Assign new value to dereferenced int==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int ^y = gcnew int(100);  &lt;br /&gt;
    *y = 110;                 &lt;br /&gt;
    Console::WriteLine(*y);   &lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create a handle to an int==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int ^y = gcnew int(100);  // create a handle to an int&lt;br /&gt;
    Console::WriteLine(y);    // print out int.&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==generic gcnew==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
generic &amp;lt;typename T&amp;gt; where T: gcnew()&lt;br /&gt;
T CreateInstance()&lt;br /&gt;
{&lt;br /&gt;
   return gcnew T();&lt;br /&gt;
}&lt;br /&gt;
ref class MyClass&lt;br /&gt;
{&lt;br /&gt;
   public:&lt;br /&gt;
   MyClass() { }&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int i = CreateInstance&amp;lt;int&amp;gt;();&lt;br /&gt;
   MyClass^ r = CreateInstance&amp;lt;MyClass^&amp;gt;();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using gcnew==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
ref class ParentClass{&lt;br /&gt;
public:&lt;br /&gt;
    ParentClass() : PVal(10) {}&lt;br /&gt;
    ParentClass(int inVal) : PVal(inVal) {}&lt;br /&gt;
    ParentClass(const ParentClass %p) : PVal(p.PVal) {}&lt;br /&gt;
    int PVal;&lt;br /&gt;
};&lt;br /&gt;
ref class ChildClass : public ParentClass{&lt;br /&gt;
public:&lt;br /&gt;
    ChildClass () : CVal(20) {};    &lt;br /&gt;
    ChildClass (int inVal1, int inVal2) : ParentClass(inVal1), CVal(inVal2) {}&lt;br /&gt;
    ChildClass(const ChildClass %vals) : ParentClass(vals.PVal), CVal(vals.CVal) {}&lt;br /&gt;
    int CVal;&lt;br /&gt;
};&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    ChildClass ^c1 = gcnew ChildClass(5,6); // Constructor&lt;br /&gt;
    ChildClass  c2 = *c1;                   // Copy Constructor&lt;br /&gt;
    c1-&amp;gt;CVal = 12;        // Change original, new unchanged&lt;br /&gt;
    Console::WriteLine(&amp;quot;c1=[{0}/{1}] c2=[{2}/{3}]&amp;quot;, &lt;br /&gt;
        c1-&amp;gt;PVal, c1-&amp;gt;CVal, c2.PVal, c2.CVal);&lt;br /&gt;
} &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>