Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interfaces 1

Status
Not open for further replies.

garths2

Programmer
Jan 15, 2002
57
US
I have just started learning C# so I appologize if this is a dumb question. Can I expose properties through an interface?

For example, I created an employee class that contains firstName and lastName properties. Then I created an IEmployee interface that I want to expose these properties. Is this possible or am I trying to do something that is not meant for interfaces.

Thanks in advance for any advice.

GS
 
An Interface does not expose anything. An interface is defined as a contract for a class that implements the interface. The contract states that any class that implements the interface will implement all the methods and properties defined in the interface.

Typically an interface is used to define methods that will be used across classes. Something more generic than an employee class.

This is a good website tutorial on interfaces:

 
perryf,

Thanks! It's exactly what I am looking for.

GS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top