26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

It provides a way to define and use operators such as +, -, and / for user-defined classes<br />

or structs. It allows us to define/redefine the way operators work with our classes and<br />

structs. This allows programmers to make their custom types look and feel like simple<br />

types such as int and string.<br />

VB.<strong>NET</strong> till now does not support operator overloading. Operator overloading is done<br />

by using the “Operator” keyword.<br />

Note:- Operator overloading is supported in VB.<strong>NET</strong> 2005<br />

(I) In below sample code if we create a object of class2<br />

which constructor will fire first ?<br />

Public Class Class1<br />

Sub New()<br />

End Sub<br />

End Class<br />

Public Class class2<br />

Inherits Class1<br />

Sub New()<br />

End Sub<br />

End Class<br />

* I leave this to the readers......<br />

(B)What’s the significance of Finalize method in .<strong>NET</strong>?<br />

.<strong>NET</strong> Garbage collector does almost all clean up activity for your objects. But unmanaged<br />

resources (ex: - Windows API created objects, File, Database connection objects, COM<br />

objects etc) is outside the scope of .<strong>NET</strong> framework we have to explicitly clean our<br />

resources. For these types of objects .<strong>NET</strong> framework provides Object.Finalize method<br />

which can be overridden and clean up code for unmanaged resources can be put in this<br />

section.<br />

(A)Why is it preferred to not use finalize for clean up?<br />

115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!