ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
How can we Achieve Late binding in C#.Can any give one example.
 Question Submitted By :: Rajesh
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can we Achieve Late binding in C#.Can any give one example.
Answer
# 1
Late Binding means compiler doesn't have any prior knowledge
about COM's methods and properties and it is delayed until
runtime. Actually program learns the addresses of methods
and properties at execution time only i.e. when those
methods and properties are invoked. Late bound code
typically refers client objects through generic data types
like 'object' and relies heavily on runtime to dynamically
locate method addresses. We do late binding in C# through
reflection. Reflection is a way to determine the type or
information about the classes or interfaces.
 
Is This Answer Correct ?    7 Yes 1 No
Dileep
 
  Re: How can we Achieve Late binding in C#.Can any give one example.
Answer
# 2
Polymorphism is the way of achieving late binding in csharp.
class A{}
class B:A{}
class Main
{
A a=new B();
}
 
Is This Answer Correct ?    8 Yes 1 No
Sukriya
 
 
 
  Re: How can we Achieve Late binding in C#.Can any give one example.
Answer
# 3
Its using Virtual functions.
When compiler encounters virtual keyword in an function 
defination, instead of binding to the function directly, 
the compiler writes a bit of dispatch code that at runtime 
will look at calling objects realtype and calls the 
function accordingly.

EX.

class baseClass
{

  protected virtual void PrintMessage()
   {
     Console.WriteLine("Hi From Base Class");
   }
}

class derivedClass : baseClass
{
   protected override void PrintMessage()
   {
     Console.WriteLine("Hi From Derived Class");
   }

}

public static void Main()
{
  baseClass b = new baseClass();
  baseClass bd = new derivedClass();

  b.PrintMessage(); // prints "Hi From Base Class"
  bd.PrintMessage(); // prints "Hi From Derived Class"
}

Here the runtime detects the correct type of object stored 
in bd i.e. derivedClass and calls dericedClass 
implementation of PrintMessage().
 
Is This Answer Correct ?    8 Yes 2 No
Saurabh
 
  Re: How can we Achieve Late binding in C#.Can any give one example.
Answer
# 4
We can achive late binding through operator loading and 
method ovealoading.
 
Is This Answer Correct ?    1 Yes 2 No
Satish
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
What does the keyword virtual mean in the method definition? Visual-Soft2
What is overloading and how can this be done ? MMTS3
what is satelite assembly? ABC3
Why can?t you specify the accessibility modifier for methods inside the interface?  2
Can you override private virtual methods? Mind-Tree8
How can i load the text box and label at the runtime based on the existing text box and tabel Merrill-Lynch1
What is stack and heap? Wipro4
How can you overload a method?  2
how can i display crystal report in button_click? am working with VS2005..........plz help me  1
Why can?t you specify the accessibility modifier for methods inside the interface?  4
How you will handle session when deploying application in more than a server? Describe session handling in a webform, how does it work and what are the limits? Microsoft3
What is the difference between Hash Table and Arrays?  5
When compiler adds a default constructor to a class? TCS3
What is the difference between readonly and constant in c# Fulcrum-Logic2
What?s an abstract class? NIIT2
an object,class is value type or refarance type. ? Synechron2
f i give input like 1,1,4,5,6,1,2,5,4,1,2, then output should be like : 1-4, 2-2, 4-2, 5-1, 6-1 which means 1 occurs 4 times, 2 occurs 2 times like so.  5
How you will connect to windows directory in c#? HP2
What are the Different kinds of methods? Wipro4
what is application domain? Kanbay3
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com