Interface vs Public class member ??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I have one question base on a choice of having a public interfcace access
compare to public class member.

IN other word let say that I have a public interface named ImyInterface with
public function and property.

Then I define a class which implements that interface.My class contains
public fcunction which provide services.

What would be advaantage and drawback of accessing my class service directly
throught public function or by public Interface member ( in that case I
declare all member of my class as private and the only access will be through
that interface)

thnaks for comments
regards
serge
 
An Interface is like a contract, which establishes a minimum set of
properties and methods that a class implementing that interface must
implement. It is useful for situations in which a variety of classes are
expected to be created, but where the client using those classes will not
know their types. As long as the client knows the Interface, it can interact
with any class that implements that Interface.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
is it a good idea to acces my class member through public interface memeber
only and declare my class memeber as all private ?
 
Not necessarily.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Back
Top