following from this test http://www.careerride.com/question-5-Csharp.NET they say the answer is A and B but I dont understand Why properties can inherit from interface, because you can't create properties in interface so how can you inherit it? thanks
Why properties can inherit from interface
An interface is not a class, it has no implementation and you cant instantiate them directly. They are just a "specification" of the properties and methods that MUST be implemented by a class that implements the interface.
In fact there are two different ways that a class can implement the properties and methods on an interface, implicit and explicit, and neither of them involve inheritance as there is nothing to inherit from. Classes can inherit from only one other class but a class can implement many interfaces both are very different relationships
This is the second time you have referenced careerride and I have to say I am not impressed with the site or the quality of questions/answer they have. I would say find a good book on C# and read that and work through things in Visual Studio (Which is free), the Wrox books are normmaly very solid on facts and teaching
An interface is not a class, it has no implementation and you cant instantiate them directly. They are just a "specification" of the properties and methods that MUST be implemented by a class that implements the interface.
In fact there are two different ways that a class can implement the properties and methods on an interface, implicit and explicit, and neither of them involve inheritance as there is nothing to inherit from. Classes can inherit from only one other class but a class can implement many interfaces both are very different relationships
This is the second time you have referenced careerride and I have to say I am not impressed with the site or the quality of questions/answer they have. I would say find a good book on C# and read that and work through things in Visual Studio (Which is free), the Wrox books are normmaly very solid on facts and teaching
I know careerride.com is bad, but I was even surprised because actually one of the company that I interviewed was using this as a test.