What is class?? What is generic class?? Differentiate
By in .NET on Mar 16 2007
  • Prakash Lakshmanan
    Dec, 2014 15

    Generic class is a class whose objects each can operate on different type of data. Below is the syntax to create generic classes [accessmodifier] class classname { members..fields } Note: While creating an object for the same do remember that we need to specify the datatypes on which that object has to operate ie. Classname objname=new Classname(); Below is an example class GenericClasses {class Test { Mytype A,B; public Test(Mytype x,Mytype y) { A=x; B=y; } public void Print() { Console.Writeline("A:{0}\t" B:{1}",A,B); } } Static Void Main() {TestT1=new Test(10,1)();Test T2=new Test(1.25,2.25)();Test T3=new Test("XYZ","ABC")();T1.Print();T2.Print();T3.Print(); } } }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS