I want to know that i have an interface named as person what is the correct way to implement it?
interface person { String Name { get; set; } }interface person { String Name { get; set; } }Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Dec 21, 2011, 5:01 PM
Posted Dec 21, 2011, 4:34 PM
Sam HobbsPosted Dec 21, 2011, 3:19 PM
For example, for each standard computer language such as C++ and C# there is just one standard but many compilers implementing that standard. Compilers can add features to a language but if the compiler does not comply with the features described in the standard then the compiler is non-standard.
An interface specifies what a class that implements the interface must do but it does not specify how it is done. An interface could define a stream but a stream could be a disk file stream, a memory stream or a network stream. The interface would for example just specify that a class must provide methods to open and close a stream and to read/write. Some streams would use a buffer but an in-memory (string) stream would not.
Sam HobbsPosted Dec 21, 2011, 2:15 PM
I assume that most people that buy the book buys it as a class textbook. There are not many programming books that have a list price over $100 except for specialized books containing material that is not available anywhere else.
VulpesPosted Dec 21, 2011, 6:47 AM
Posted Dec 20, 2011, 4:02 PM
Sam HobbsPosted Dec 20, 2011, 1:35 PM
Can you tell us what book?
VulpesPosted Dec 20, 2011, 12:59 PM
Posted Dec 20, 2011, 12:31 PM
An interface is a collection of methods (and perhaps other members) that can be used by any class, as long as the class provides a definition to override the interface's do-nothing, or abstract, definition.
Sam HobbsPosted Dec 19, 2011, 7:23 PM
Posted Dec 19, 2011, 4:51 PM
VulpesPosted Dec 19, 2011, 4:31 PM
Posted Dec 19, 2011, 4:25 PM
Sam HobbsPosted Dec 19, 2011, 3:51 PM
VulpesPosted Dec 19, 2011, 1:53 PM
You can then write generic code which applies to all types which implement the interface because you know that they must contain certain members even though they'll (usually) be implemented differently.
The purpose of the above example was to show how to implement an interface, not to demonstrate why it's useful.
Posted Dec 19, 2011, 1:47 PM
VulpesPosted Dec 17, 2011, 6:54 PM
Sam HobbsPosted Dec 17, 2011, 6:38 PM
It is unfortunate that properties cannot be implemented as Auto-Implemented Properties in derived classes.
VulpesPosted Dec 17, 2011, 8:24 AM