GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 395 of 436    Print  
Only a 'Static' method can be called using delegate - True / False? Give Reason

  
Total Answers and Comments: 3 Last Update: May 27, 2008     Asked by: Dhanapal 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 12, 2007 22:29:51   #1  
factpandit Member Since: December 2007   Contribution: 2    

RE: Only a 'Static' method can be called using delegate - True / False? Give Reason
I think the answer is "false".

Delegate is a type just like a class or a structure.

So any number of methods that have similar format (return type and parameters) but with differet names as that of a delegate type can all be treated as objects of a delgate type (Of course delegates are nothing but function pointers).

Their scope and visibility won't matter. For the matter of fact even a private method of an object oA of a class A that is passed as a delegate to another object oB of class B can be called with out any compile or run time problem. So this can be treated as a work around for accessing of private methods of an object from a different type object.

Does this make sense?

Cheers :)
FP

 
Is this answer useful? Yes | No
January 25, 2008 12:54:12   #2  
whbloodworth Member Since: January 2008   Contribution: 4    

RE: Only a 'Static' method can be called using delegate - True / False? Give Reason

In C# this is false. C# delegates can be assigned to instance methods as well. In C++ this is true.


 
Is this answer useful? Yes | No
May 27, 2008 05:44:04   #3  
nikhilrawat23 Member Since: May 2008   Contribution: 15    

RE: Only a 'Static' method can be called using delegate - True / False? Give Reason
false in c#
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape