473,396 Members | 1,748 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,396 software developers and data experts.

Declaring constructor interfaces [in interfaces]

I want to declare an interface that forces the presence of a certain
constructor (in this case, "Sub New(ByVal ds As DataSet)"). When I
try, I get a

'Sub New' cannot be declared in an interface.

.... error.

Now I could create an object that implements the interface that
includes the contructor and extend it, sure, but as I understand it,
VB.NET isn't going to let me use multiple inheritence, and I need the
interfaces to be implemented by Controls (Panels and UserControls,
mostly). So creating an object with the constructor really isn't an
option.

Is there a way I can declare/require the existence of a certain
constructor in an "interface-like fashion"?

Thanks,

Ruffin Bailey

--
Wasted bandwidth from a "professional" programmer
http://myfreakinname.blogspot.com
Nov 20 '05 #1
1 6786
You might want to look into a Factor design pattern...

http://www.dofactory.com/Patterns/Patterns.aspx#list
"Ruffin Bailey" <ka****@atari.net> wrote in message
news:17**************************@posting.google.c om...
I want to declare an interface that forces the presence of a certain
constructor (in this case, "Sub New(ByVal ds As DataSet)"). When I
try, I get a

'Sub New' cannot be declared in an interface.

... error.

Now I could create an object that implements the interface that
includes the contructor and extend it, sure, but as I understand it,
VB.NET isn't going to let me use multiple inheritence, and I need the
interfaces to be implemented by Controls (Panels and UserControls,
mostly). So creating an object with the constructor really isn't an
option.

Is there a way I can declare/require the existence of a certain
constructor in an "interface-like fashion"?

Thanks,

Ruffin Bailey

--
Wasted bandwidth from a "professional" programmer
http://myfreakinname.blogspot.com

Nov 20 '05 #2

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

Similar topics

5
by: Peter Berry | last post by:
I was surprised and somewhat disappointed by the fact that you cannot declare types in an interface. I discovered this when defining an interface that included events, where the definition of the...
3
by: Claire | last post by:
I want to declare a set of descendent exception classes that contains no extra code to the base. It's so I can test the class type of exception and handle its error code differently depending on...
26
by: Paul | last post by:
public class A { public A () { // here I would like to call the second version of _ctor, how to accomplish this ? } public A (int a, int b, int c) {
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
1
by: Joe Jax | last post by:
I have an object which has a base object hierarchy as well as a number of implemented interfaces. Given any one property on that object, how do I find out which base class or interface defines that...
15
by: CR | last post by:
I've noticed that the trend these days is to declare variables in the middle of code instead of at the top. What is the advantage of this? It seems like it makes it hard to reuse variables. Here...
6
by: Steven Livingstone | last post by:
Bit of advice here folks. I am creating a default constructor that just initializes a new instance of my object and a secon constructor that takes an ID and loads an object with data from the...
10
by: AZRebelCowgirl73 | last post by:
This is what I have so far: My program! import java.util.*; import java.lang.*; import java.io.*; import ch06.lists.*; public class UIandDB {
1
by: Peter Duniho | last post by:
On Fri, 11 Apr 2008 01:43:52 -0700, Weeble <clockworksaint@gmail.com> wrote: That's not a difference. The code example you compared to has the implication that A will use the IB instance...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.