PC Review


Reply
Thread Tools Rate Thread

Declaring constructor interfaces [in interfaces]

 
 
Ruffin Bailey
Guest
Posts: n/a
 
      20th Feb 2004
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
 
Reply With Quote
 
 
 
 
CJ Taylor
Guest
Posts: n/a
 
      20th Feb 2004
You might want to look into a Factor design pattern...

http://www.dofactory.com/Patterns/Patterns.aspx#list


"Ruffin Bailey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vb.net interfaces douglas Microsoft VB .NET 2 7th Apr 2009 05:43 AM
Can I expose my API/COM interfaces as .Net interfaces? rakefet@repliweb.com Microsoft Dot NET 6 18th Aug 2005 08:01 AM
Can I expose my API/COM interfaces as .Net interfaces? rakefet@repliweb.com Microsoft C# .NET 1 17th Aug 2005 08:16 PM
Help with ADO.Net Interfaces =?Utf-8?B?TWF0dGhldyBIb2x0b24=?= Microsoft Dot NET 5 5th Apr 2005 09:01 PM
Declaring and using COM interfaces in C# Peter Zwosta Microsoft C# .NET 3 30th Dec 2004 10:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:34 PM.