<?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=Csharp%2FC_Sharp%2FGenerics%2FGeneric_Class_Hierarchy</id>
		<title>Csharp/C Sharp/Generics/Generic Class Hierarchy - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGenerics%2FGeneric_Class_Hierarchy"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Generics/Generic_Class_Hierarchy&amp;action=history"/>
		<updated>2026-04-30T02:52:33Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Generics/Generic_Class_Hierarchy&amp;diff=1348&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Generics/Generic_Class_Hierarchy&amp;diff=1348&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:19Z</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=Csharp/C_Sharp/Generics/Generic_Class_Hierarchy&amp;diff=1349&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Generics/Generic_Class_Hierarchy&amp;diff=1349&amp;oldid=prev"/>
				<updated>2010-05-26T11:45:45Z</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;==A derived class with its own type parameters==&lt;br /&gt;
&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;
using System;&lt;br /&gt;
class MyClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  T ob;&lt;br /&gt;
  public MyClass(T o) {&lt;br /&gt;
    ob = o;&lt;br /&gt;
  }&lt;br /&gt;
  public T getob() {&lt;br /&gt;
    return ob;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class ClassA&amp;lt;T, V&amp;gt; : MyClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  V ob2;&lt;br /&gt;
  public ClassA(T o, V o2) : base(o) {&lt;br /&gt;
    ob2 = o2;&lt;br /&gt;
  }&lt;br /&gt;
  public V getob2() {&lt;br /&gt;
    return ob2;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Test {&lt;br /&gt;
  public static void Main() {&lt;br /&gt;
    ClassA&amp;lt;string, int&amp;gt; x = new ClassA&amp;lt;string, int&amp;gt;(&amp;quot;Value is: &amp;quot;, 9);&lt;br /&gt;
    Console.Write(x.getob());&lt;br /&gt;
    Console.WriteLine(x.getob2());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A non-generic class can be the base class of a generic derived class==&lt;br /&gt;
&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;
using System;&lt;br /&gt;
class MyBaseClass {&lt;br /&gt;
  int num;&lt;br /&gt;
  public MyBaseClass(int i) {&lt;br /&gt;
    num = i;&lt;br /&gt;
  }&lt;br /&gt;
  public int getnum() {&lt;br /&gt;
    return num;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class MyGenericClass&amp;lt;T&amp;gt; : MyBaseClass {&lt;br /&gt;
  T ob;&lt;br /&gt;
  public MyGenericClass(T o, int i) : base (i) {&lt;br /&gt;
    ob = o;&lt;br /&gt;
  }&lt;br /&gt;
  public T getob() {&lt;br /&gt;
    return ob;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class HierDemo3 {&lt;br /&gt;
  public static void Main() {&lt;br /&gt;
    MyGenericClass&amp;lt;String&amp;gt; w = new MyGenericClass&amp;lt;String&amp;gt;(&amp;quot;Hello&amp;quot;, 7);&lt;br /&gt;
    Console.WriteLine(w.getob());&lt;br /&gt;
    Console.WriteLine(w.getnum());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A simple generic class hierarchy==&lt;br /&gt;
&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;
using System;&lt;br /&gt;
class GenericClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  T myObject;&lt;br /&gt;
  public GenericClass(T o) {&lt;br /&gt;
    myObject = o;&lt;br /&gt;
  }&lt;br /&gt;
  public T getmyObject() {&lt;br /&gt;
    return myObject;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class GenericClass2&amp;lt;T&amp;gt; : GenericClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  public GenericClass2(T o) : base(o) {&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Test {&lt;br /&gt;
  public static void Main() {&lt;br /&gt;
    GenericClass2&amp;lt;string&amp;gt; g2 = new GenericClass2&amp;lt;string&amp;gt;(&amp;quot;www.nfex.ru&amp;quot;);&lt;br /&gt;
    Console.WriteLine(g2.getmyObject());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overriding a virtual method in a generic class==&lt;br /&gt;
&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;
using System;&lt;br /&gt;
class MyBaseGenericClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  protected T myObject;&lt;br /&gt;
  public MyBaseGenericClass(T o) {&lt;br /&gt;
    myObject = o;&lt;br /&gt;
  }&lt;br /&gt;
  public virtual T getmyObject() {&lt;br /&gt;
    Console.Write(&amp;quot;Base&amp;quot;s getmyObject(): &amp;quot; );&lt;br /&gt;
    return myObject;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class MyGenericClass&amp;lt;T&amp;gt; : MyBaseGenericClass&amp;lt;T&amp;gt; {&lt;br /&gt;
  public MyGenericClass(T o) : base(o) {  }&lt;br /&gt;
  public override T getmyObject() {&lt;br /&gt;
    Console.Write(&amp;quot;overide getmyObject(): &amp;quot;);&lt;br /&gt;
    return myObject;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Test {&lt;br /&gt;
  public static void Main() {&lt;br /&gt;
    MyBaseGenericClass&amp;lt;int&amp;gt; myObject = new MyBaseGenericClass&amp;lt;int&amp;gt;(8);&lt;br /&gt;
    Console.WriteLine(myObject.getmyObject());&lt;br /&gt;
    myObject = new MyGenericClass&amp;lt;int&amp;gt;(9);&lt;br /&gt;
    Console.WriteLine(myObject.getmyObject());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The overriding method cannot change the inherited constraints.==&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;
using System;&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    public virtual void MethodA&amp;lt;T&amp;gt;(T arg)&lt;br /&gt;
        where T : new() {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class YClass : MyClass {&lt;br /&gt;
    public override void MethodA&amp;lt;T&amp;gt;(T arg) {&lt;br /&gt;
        T obj = new T();&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>