Krishna Rajput Singh
What is the Signification of the "new " keyword in C#? example
By Krishna Rajput Singh in C# on Jul 17 2014
  • Sandesh Patil
    Jul, 2014 24

    used to create instance of a class or to shadow a method declared in base class.

    • 2
  • Safayat Zisan
    Apr, 2015 17

    new is used to allocate memory in hard drive. example: int() a = new int(10) here, new keyword is allocating 10 integer numbers in a array

    • 1
  • Dhanik Sahni
    Oct, 2014 9

    It is allocating reference to instance

    • 1
  • Mohit Kumar
    Jul, 2014 28

    used for creating the new object for the class and hiding the member of parent class in child if it is intended.For similar kind of interview question check this also c# interview questions

    • 1
  • Krishna Rajput Singh
    Jul, 2014 17

    In C# the "new" keyword is used to create an instance of a class.for example: public class Student { } Student objstudent=new Student():

    • 1
  • Alok Tripathi
    Mar, 2017 29

    "new" keyword is used to create a object in a heap. Basically any object have two parts first is "reference variable" and other is "object" itself , reference variable is resides in stack and object is in heap. So new in used to create the object in heap and the reference variable is used to point the object in heap.Ex : Employee E1(ref var)= new Employee();(object created in heap)and these objects are clean by the garbage collector when it not used for long times.

    • 0
  • Ashu Elahi
    Sep, 2016 6

    New is used to allocate the memory for object reference

    • 0
  • Amatya Agyey
    Apr, 2016 7

    To allocate reference to instanceThanks

    • 0
  • vipin kv
    Oct, 2015 5

    used for class object creation and method hiding

    • 0
  • vipin kv
    Oct, 2015 5

    new keyword can be used to create class instance or can be used in method hiding

    • 0
  • Rahul Prajapat
    Jun, 2015 1

    new keyword is use to get an reference of a class, structure . when we use a new operator then a memory block of size of object type(class/reference) is allocated in memory and address of this memory block is assigned to object

    • 0
  • Pankaj  Kumar Choudhary
    Mar, 2015 28

    new keyword is use to get an reference of a class, structure . when we use a new operator then a memory block of size of object type(class/reference) is allocated in memory and address of this memory block is assigned to object

    • 0
  • Maruthi Pallamalli
    Feb, 2015 11

    New is a keyword. To get reference or addressing of the objects. New keyword will work for Variables(int,float ,..... example : int i=new int();) New keyword will work for class ( classA a =new classA(); ) New keyword also work as modifier publc classA { public void AB(){ } } public classB:A { new public void AB() { } } More over it will use to assign memory dynamically

    • 0
  • Munesh Sharma
    Oct, 2014 9

    http://msdn.microsoft.com/en-us/library/ms173153.aspx

    • 0
  • Manoj Rawat
    Aug, 2014 9

    Example- foo obj = new foo(); Left Part initializes/declares the object and right part ( new foo() ) allocates memory to newly created Object.Please Correct me if i am wrong. :)

    • 0
  • jayasri
    Aug, 2014 1

    In C#, a method in a derived class can have the same name as a method in the base class. You can specify how the methods interact by using the new and override keywords. The override modifier extends the base class method, and the new modifier hides it. The difference is illustrated in the examples in this topic.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS