473,765 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface vs Public class member ??

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
Apr 25 '07 #1
3 1494
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

"calderara" <ca*******@disc ussions.microso ft.comwrote in message
news:41******** *************** ***********@mic rosoft.com...
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

Apr 25 '07 #2
is it a good idea to acces my class member through public interface memeber
only and declare my class memeber as all private ?
"Kevin Spencer" wrote:
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

"calderara" <ca*******@disc ussions.microso ft.comwrote in message
news:41******** *************** ***********@mic rosoft.com...
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


Apr 25 '07 #3
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

"calderara" <ca*******@disc ussions.microso ft.comwrote in message
news:16******** *************** ***********@mic rosoft.com...
is it a good idea to acces my class member through public interface
memeber
only and declare my class memeber as all private ?
"Kevin Spencer" wrote:
>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

"calderara" <ca*******@disc ussions.microso ft.comwrote in message
news:41******* *************** ************@mi crosoft.com...
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



Apr 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8204
by: Roy Pereira | last post by:
I have an application that is composed of a set of "Content" dlls and a viewer application. The viewer calls a standard set of functions that are present in all the dlls. I maintain this by making my contnent dlls implement an interface created in vb6. The viewer application is bound to this interface. This way, I am able to add Content without redeploying the dlls (I just have to add the new dlls). I want to write new content for...
9
4649
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
6
4887
by: Martin | last post by:
Hi, Suppose I have 3 interfaces : IStats IEngine ICreateCar each derives from IUnknown
3
3370
by: Davide M3xican Coppola | last post by:
Hi, I would realize an interface (interface) for a pair of concrete classes (concrete & concrete2), but I have a problem because I have to access to a third class (element) and if I try to declare interface class as friend, I obtain this (right) error: main2.cpp: In member function `virtual void concrete::method(element&)': main2.cpp:8: error: `int element::a_int' is protected main2.cpp:31: error: within this context
3
3244
by: Christof Warlich | last post by:
Hi, I'm looking for a more concise way than below to extend an existing interface. Just imagine that class Interface would have 1000 other members and class DerivedInterface only needs to add / modify _one_ member. The implementation shall remain invisible to the application (i.e. main()). Thanks for any suggestions,
21
13846
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
4
6999
by: Guy | last post by:
Hi i have a base class (marked 'MustInherit') with a public property called IsValid and a public event called Vali i have a class (lets call it 'Client') that inherits this base class so the Client class now has a public event called valid and a public property called IsVali the client class implements an interface called IListEditorItem, this interface declares two things... (can you guess? a public event called Vali and a public...
8
5820
by: Bill Rust | last post by:
I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a specialized class that works with my application framework. In the wizard, the user can select the interfaces they would like to support. During the code generation phase, I add an "Implements Ixxx" for each interface they select, but I've not yet figured out how to add the skeleton implementation for those interfaces. Once the user opens the class in the VS...
52
20906
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member 'UselessJunkForDissassembly.IInvocableInternals.OperationValidate(string)' C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.