Re: interface - why does implementation have to be public?
From: Patrick Steele [MVP] (patrick_at_mvps.org)
Date: 02/10/04
- Next message: Mark H: "MSHTML works on Dev, not on Target"
- Previous message: Ben: "http file uploads using HttpWebResponse"
- In reply to: Mark: "interface - why does implementation have to be public?"
- Next in thread: Mattias Sjögren: "Re: interface - why does implementation have to be public?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 15:33:10 -0500
In article <e$ul6pA8DHA.2796@TK2MSFTNGP09.phx.gbl>,
mfield@idonotlikespam.cce.umn.edu says...
> Below I've created an interface ... why do all implementations of the
> methods have to be public? What if I want them to be private or protected?
>
> public interface IOisWebPageStandard
> {
> void SomeMethod1();
> void SomeMethod2();
> void SomeMethod3();
> }
What's the point in having an interface (a "contract" between two
parties) if you don't want the other party to be able to see the method?
The goal of an interface is to define how the object can be accessed by
the outside world.
Private/protected stuff is an internal implementation detail to the
class and has no bearing on those that use the class.
-- Patrick Steele Microsoft .NET MVP http://weblogs.asp.net/psteele
- Next message: Mark H: "MSHTML works on Dev, not on Target"
- Previous message: Ben: "http file uploads using HttpWebResponse"
- In reply to: Mark: "interface - why does implementation have to be public?"
- Next in thread: Mattias Sjögren: "Re: interface - why does implementation have to be public?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|