473,320 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

when to use an Interface (the template like thing) in my project?

Hello,

my project (vb2005) contains several classes that each produce lists of data
which get stored/displayed in ado.net tables that have the same structure for
each of the lists produced by each class. Class1 produces 3 lists which get
stored in 3 ado.net tables (each table has a different structure). Class2
produces 3 similar lists that get stored in the same 3 ado.net tables.
Class3...class8 also produce 3 lists per class that get stored in the same 3
ado.net tables. Each class contains the same sub which takes the same args,
but the sql to produce the lists is different for each class. The lists are
similar in structure but way different in content.

Right now I select a class based on selections from a from. If optionbtn1
is checked I produce my lists using class1, optionbtn2 ... class2...

If Option1.Checked.Equals(true) then
cls = new class1
ElseIf Option2.Checked.Equals(true) then
cls = new class2
....
cls.RunSub(arg1, arg2)
....

I have used an interface thing once before to be able to loop through a
collection of classes. I looped through the interface. In the scenario
above would there be any use for an interface? If yes, what do I gain by
using an Interface thing

And what is the correct expression/name for the Interface thing I am talking
about? I don't like referring to it as a Thing. Is it an object? a class?

Thanks,
Rich
Oct 27 '06 #1
1 1197
An interface is like a contract. It can contain defintions for
properties and methods, but it can't contain any code or data. If a
class inherits an interface, it has to implement what the interface
specifies.

An interface works pretty much like an abstract base class that only
contains abstract properties and abstract methods, only a class can
inherit as many interfaces as it wants, but only inherit from one base
class.

Interfaces are usually used to specify capabilites of a class, like a
class that inherits IList can be used as a list.

Usually the type of a reference is a class, but you can also use an
interface as type. That means that the reference can be used for any
object that inherits the interface, and you can use any properties or
methods that the interface specify without caring what the actual class
of the object is.
Rich wrote:
Hello,

my project (vb2005) contains several classes that each produce lists of data
which get stored/displayed in ado.net tables that have the same structure for
each of the lists produced by each class. Class1 produces 3 lists which get
stored in 3 ado.net tables (each table has a different structure). Class2
produces 3 similar lists that get stored in the same 3 ado.net tables.
Class3...class8 also produce 3 lists per class that get stored in the same 3
ado.net tables. Each class contains the same sub which takes the same args,
but the sql to produce the lists is different for each class. The lists are
similar in structure but way different in content.

Right now I select a class based on selections from a from. If optionbtn1
is checked I produce my lists using class1, optionbtn2 ... class2...

If Option1.Checked.Equals(true) then
cls = new class1
ElseIf Option2.Checked.Equals(true) then
cls = new class2
...
cls.RunSub(arg1, arg2)
...

I have used an interface thing once before to be able to loop through a
collection of classes. I looped through the interface. In the scenario
above would there be any use for an interface? If yes, what do I gain by
using an Interface thing

And what is the correct expression/name for the Interface thing I am talking
about? I don't like referring to it as a Thing. Is it an object? a class?

Thanks,
Rich
Oct 27 '06 #2

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

Similar topics

8
by: Eric Veltman | last post by:
Hello everyone, I've posted this question before, but got no answer, so I'll try to reformulate the question, maybe it helps :-) By the way, this is not intended as the start of an ASP.NET...
2
by: Saul Behr | last post by:
For all Microsoft's blah about C# and VB being completely mixable and interchangeable, I recommend for anyone who can still take this advice: DO NOT MIX VB AND C# PROJECTS IN THE SAME SOLUTION!...
4
by: Steve B. | last post by:
Are there rules/policy for creating a new ADO VS project to a solution? When should I create a new ADO project for a VS solution? Is there anything like a limit to the number of object files you...
10
by: Brett | last post by:
I'm still trying to figure out concrete reasons to use one over the other. I understand the abstract class can have implementation in its methods and derived classes can only inherit one abstract...
3
by: dan_roman | last post by:
Hi, I developed a script with a nice interface in Tkinter that allows me to edit some formulas and to generate an Excel worksheet with VBA macros within it. The script runs perfectlly in Office...
2
by: IR | last post by:
Hi, Still playing around with templates, I have the following questions... I know how to express "positive" compile time assertions of a class's interface in templates (ie. T has-a member...
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
6
by: Wayne Shu | last post by:
hi everyone! I have a problem in implementing a common class interface. my assignment is to implement a data structure list, and I have define a class template list_base, it's an abstract class,...
3
by: ewpatton | last post by:
Hi, I have written a DLL in C++.NET that contains a class inherited from a single abstraction: //------ IThing.h ------ #ifndef __ITHING_H__ #define __ITHING_H__ namespace DLLObject
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.