Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
1.80/5 (3 votes)
See more:
please help me understanding the artical by giving me an suitable Example.

my dought is that .

1.Does we declare the interface method Virtual explicitly . example

2." If an interface method is sealed, a derived class cannot override the method. However, a derived class can re-inherit the same interface and can provide its own implementation for the interface’s methods. " what does it mean.





"The CLR requires that interface methods be marked as virtual. If you do not explicitly mark the method as virtual in your source code, the compiler marks the method as virtual and sealed; this prevents a derived class from overriding the interface method. If you explicitly mark the method as virtual, the compiler marks the method as virtual (and leaves it unsealed); this allows a derived class to override the interface method. If an interface method is sealed, a derived class cannot override the method. However, a derived class can re-inherit the same interface and can provide its own implementation for the interface’s methods."


pleas help me to make the clear understanding of the above paragraph i will be very thankful to you.
Posted

Hello friend, please visit the following article to understand Interface in C#:
Interfaces in C# (For Beginners)[^]
Hope this will help you. :)
- DD
 
Share this answer
 
Comments
siddharth629 13-Jun-14 3:07am    
"If you explicitly mark the method as virtual, the compiler marks the method as virtual (and leaves it unsealed)"

what dosed it mean i want to know can we explicitly mark the methods as virtual.
siddharth629 13-Jun-14 3:07am    
If an interface method is sealed, a derived class cannot override the method. However, a derived class can re-inherit the same interface and can provide its own implementation for the interface’s methods."


and what does it mean ...plz explain only these tow line

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