473,856 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is an Interface

I Picture an Interface as a list of references to methods and properties.
It's nothing except a spec. until it is implemented.

if that is so what is "components "?
Private components As System.Componen tModel.IContain er

If it's an inteface where is the implementation?




Nov 20 '05 #1
4 1104
" SamSpade" <st************ **@REMOVEaol.co m> schrieb
I Picture an Interface as a list of references to methods and
properties. It's nothing except a spec. until it is implemented.
Right. Also often defined as a "contract".
if that is so what is "components "?
Private components As System.Componen tModel.IContain er

If it's an inteface where is the implementation?


The implementation is done in the object (or in the class) assigned to the
variable.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
> > If it's an inteface where is the implementation?

The implementation is done in the object (or in the class) assigned to the
variable.

I didn't think about the base class. That must be where!

Thanks
Nov 20 '05 #3
Public Class Mother

End Class
''''''''''''''' '''''''
Public Class Son
Inherits Mother

End Class

''''''''''''''' ''''''''''''''' '''''''''''''''

Dim x As Mother
x=New Son()

As you see, I have set the variable of type Mother with the reference to an
instance of the type Son(derived from Mother). Welcome to the universe of
the polymorphism. :-))

So, the field "components " is of type IContainer, but points to an instance
of a class(that has the implementation for IContainer interface).
In your form, look for the line of code where the field "components " gets
its value. For sure you will find something different from IContainer.

Ernest

" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:uy******** ******@TK2MSFTN GP10.phx.gbl...
I Picture an Interface as a list of references to methods and properties.
It's nothing except a spec. until it is implemented.

if that is so what is "components "?
Private components As System.Componen tModel.IContain er

If it's an inteface where is the implementation?




Nov 20 '05 #4
* " SamSpade" <st************ **@REMOVEaol.co m> scripsit:
I Picture an Interface as a list of references to methods and properties.
It's nothing except a spec. until it is implemented.

if that is so what is "components "?
Private components As System.Componen tModel.IContain er
This variable can hold references to objects of type 'IContainer' and
all of its subtypes. Subtypes of 'IContainer' are of type 'IContainer'
and consequently can be assigned to the variable. 'IContainer' is an
interface, so you cannot instantiate it directly, but you can
instantiate a class that implements the interface and assign it to the
variable.
If it's an inteface where is the implementation?


In a class that implements the interface, for example:

\\\
Public Class Foo
Implements IContainer

Nov 20 '05 #5

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

Similar topics

5
1554
by: HAM | last post by:
One of my friends asked if the followings have any meanings? '------------- Public Interface IRenderable Sub Render() MustInherit Class Engine MustOverride Sub TurnOn() Interface IAutomatic Sub Start() End Interface
12
2818
by: Steve W. | last post by:
I just read the section (and did the exercise) in the C# Step by Step book that covers Explict Interface Implementation (where you specify in the method implementation the specific interface that you are implementing in the class. Other than to resolve the problem that arises when a class implements two interfaces with the same method signature, what good is it?
3
15760
by: Amit chaturvedi | last post by:
Dear Friends Please tell me following thing Que -: what is the main use of interface in .net Que -: What is difference between abstract class and interface Que -: How to make class in Object Oriented Form? (in c# Please mail me at my mail id - chaturvediamit2001@yahoo.co.in
21
13858
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...
6
6086
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives using System; using System.Collections.Generic; using System.Text;
1
10425
by: Mitan | last post by:
Hello, I'm a beginner with what appears to be a simple question for which I haven't been able to get an answer. Can someone explain what "implementation code" is in relation to VB.NET? I want to be sure I have a good understanding of this before I continue with my studies. Thanks in advance. Semper Fi
19
2908
by: Charles Law | last post by:
Take a solution with a project hierarchy along the lines of an n-tier system, so that we have a data layer, business layer and presentation layer. The presentation layer is coupled to the business layer, and the business layer is coupled to the data layer. So far so good. Suppose the data layer raises an event, and it passes Me (the sender) as an object, and e (MyEventArgs, a descendent of EventArgs) to the layer above (the business...
4
20645
by: Raja Chandrasekaran | last post by:
Hai friends, I really wonder, If the interface does not have any definition, Y do we need to use interface. You can then only we can use Multiple inheritance. I really cant understand, Just for declararion y do we need to use interface. Anyhow the method name and definition ll be in the derived class. Instead of that we can do all code in the derived class itself right...? Then y these concept came. If anybody know, please explain me...
17
2290
by: Zytan | last post by:
Aren't all classes interfaces? What constitutes an interface (and with it, the "I" prefix distinction)? Zytan
6
1895
by: S_K | last post by:
Hi, I've been toying around with interfaces in C#. They are fun but can anybody give me some examples of where interfaces are used and what they are used for? Thanks so much. Steve
0
9920
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
9764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10699
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
10790
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
10390
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
9535
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...
0
7098
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4580
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.