Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,


Can any one tell me how to override static calss in c# 3.5.Waiting for reply.


Regards,
Shameen
Posted

1 solution

You can't - static items cannot be overridden. There is a good explanation why not here: http://blogs.msdn.com/b/kirillosenkov/archive/2008/02/06/how-to-override-static-methods.aspx[^]
 
Share this answer
 
Comments
Mehdi Gholam 11-Oct-11 6:54am    
My 5!
Sergey Alexandrovich Kryukov 17-Nov-11 22:48pm    
Here is the thing: this explanation is wrong; technologies where static methods can be virtual and can be overridden do exist (take Object Pascal and Delphi, for example) and it makes perfect sense. I can easily explain why it does not contradict to anything at all and how it's useful (well, very). .NET just uses a bit different model (despite its inheritance from Delphi), and this model is not better, just different.

At to the author of this article, it looks like he was just dominated by the uncomfortable fact of having this .NET model not rationally explained and desire to give some explanation. The explanation is artificial, an attempt to force logic to the "fact".

(I did not vote, because it can be considered as contradictory matter and not well known; not finding a logical flaw is not a good reason for down-voting.)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900