PC Review


Reply
Thread Tools Rate Thread

"Abstract" interface ?

 
 
Steve B.
Guest
Posts: n/a
 
      25th Jul 2005
Hi,

I have 3 interfaces in my app in order to allow my app to be extensible.

INode,
IDestination : INode
ISource : INode

I do not want developpers to implement INode, but at least IDestination or
ISource.
The keyword "abstract" is not allowed for interfaces. Is there any way to
reach my goal ?

Thanks,
Steve


 
Reply With Quote
 
 
 
 
jan.bannister@gmail.com
Guest
Posts: n/a
 
      25th Jul 2005
mark it 'internal'

 
Reply With Quote
 
Steve B.
Guest
Posts: n/a
 
      25th Jul 2005
No it does not works :

"Error 1 Inconsistent accessibility: base interface 'Core.INode' is less
accessible than interface 'Core.IDest' "

namespace Core

{

internal interface INode

{

string ParentProperty { get;}

}

public interface IDest : INode

{

string DestProperty { get;}

}

public interface ISrc : INode

{

string DestProperty { get;}

}

}

<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
> mark it 'internal'
>



 
Reply With Quote
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      25th Jul 2005
None that I can think of.

Interfaces represent contracts. By their very nature, you must expose all
"parent" contracts in an inheritance chain with the same level of exposure.
It is possible to go this direciton:

public interface INode
{
}

internal interface IDestination : INode
{
}

internal interface ISource : INode
{
}

but not this direction:

internal interface INode
{
//Methods
bool Method1();
}

public interface IDestination : INode
{
}

public interface ISource : INode
{
}

There is no abstract keyword for interfaces as interfaces are abstract by
nature (ie, no implementation).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"Steve B." wrote:

> Hi,
>
> I have 3 interfaces in my app in order to allow my app to be extensible.
>
> INode,
> IDestination : INode
> ISource : INode
>
> I do not want developpers to implement INode, but at least IDestination or
> ISource.
> The keyword "abstract" is not allowed for interfaces. Is there any way to
> reach my goal ?
>
> Thanks,
> Steve
>
>
>

 
Reply With Quote
 
ernesto bascón pantoja
Guest
Posts: n/a
 
      25th Jul 2005
I think you should provide abstract implementation of your interfaces like

public abstract class DestinationBase : IDestination;

public abstract class SourceBase : ISource;

and to expose only DestinationBase and SourceBase in your APIs.

Best regards,



Ernesto



"Cowboy (Gregory A. Beamer) - MVP" <(E-Mail Removed)> wrote
in message news:310B7C7F-7E23-41AE-B34E-(E-Mail Removed)...
> None that I can think of.
>
> Interfaces represent contracts. By their very nature, you must expose all
> "parent" contracts in an inheritance chain with the same level of
> exposure.
> It is possible to go this direciton:
>
> public interface INode
> {
> }
>
> internal interface IDestination : INode
> {
> }
>
> internal interface ISource : INode
> {
> }
>
> but not this direction:
>
> internal interface INode
> {
> //Methods
> bool Method1();
> }
>
> public interface IDestination : INode
> {
> }
>
> public interface ISource : INode
> {
> }
>
> There is no abstract keyword for interfaces as interfaces are abstract by
> nature (ie, no implementation).
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "Steve B." wrote:
>
>> Hi,
>>
>> I have 3 interfaces in my app in order to allow my app to be extensible.
>>
>> INode,
>> IDestination : INode
>> ISource : INode
>>
>> I do not want developpers to implement INode, but at least IDestination
>> or
>> ISource.
>> The keyword "abstract" is not allowed for interfaces. Is there any way to
>> reach my goal ?
>>
>> Thanks,
>> Steve
>>
>>
>>



 
Reply With Quote
 
Steve B.
Guest
Posts: n/a
 
      26th Jul 2005
thanks for these answers.... I 'm a little disappointed


"ernesto bascón pantoja" <(E-Mail Removed)> a écrit dans le message de
news: %23d$(E-Mail Removed)...
>I think you should provide abstract implementation of your interfaces like
>
> public abstract class DestinationBase : IDestination;
>
> public abstract class SourceBase : ISource;
>
> and to expose only DestinationBase and SourceBase in your APIs.
>
> Best regards,
>
>
>
> Ernesto
>
>
>
> "Cowboy (Gregory A. Beamer) - MVP" <(E-Mail Removed)>
> wrote in message
> news:310B7C7F-7E23-41AE-B34E-(E-Mail Removed)...
>> None that I can think of.
>>
>> Interfaces represent contracts. By their very nature, you must expose all
>> "parent" contracts in an inheritance chain with the same level of
>> exposure.
>> It is possible to go this direciton:
>>
>> public interface INode
>> {
>> }
>>
>> internal interface IDestination : INode
>> {
>> }
>>
>> internal interface ISource : INode
>> {
>> }
>>
>> but not this direction:
>>
>> internal interface INode
>> {
>> //Methods
>> bool Method1();
>> }
>>
>> public interface IDestination : INode
>> {
>> }
>>
>> public interface ISource : INode
>> {
>> }
>>
>> There is no abstract keyword for interfaces as interfaces are abstract by
>> nature (ie, no implementation).
>>
>> --
>> Gregory A. Beamer
>> MVP; MCP: +I, SE, SD, DBA
>>
>> ***************************
>> Think Outside the Box!
>> ***************************
>>
>>
>> "Steve B." wrote:
>>
>>> Hi,
>>>
>>> I have 3 interfaces in my app in order to allow my app to be extensible.
>>>
>>> INode,
>>> IDestination : INode
>>> ISource : INode
>>>
>>> I do not want developpers to implement INode, but at least IDestination
>>> or
>>> ISource.
>>> The keyword "abstract" is not allowed for interfaces. Is there any way
>>> to
>>> reach my goal ?
>>>
>>> Thanks,
>>> Steve
>>>
>>>
>>>

>
>



 
Reply With Quote
 
larrylard@hotmail.com
Guest
Posts: n/a
 
      26th Jul 2005


Steve B. wrote:
> Hi,
>
> I have 3 interfaces in my app in order to allow my app to be extensible.
>
> INode,
> IDestination : INode
> ISource : INode
>
> I do not want developpers to implement INode, but at least IDestination or
> ISource.


Any class that implements IDestination or ISource *must* implement
INode. Why does it matter to you if someone implements INode but not a
subinterface? Make your other procedures require IDestination's or
ISource's (with overloading), and you will never be passed a 'plain'
INode.

--
Larry Lard
Replies to group please

 
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
I cannot empty my "deleted files" folder but get an"interface" er Eugene Microsoft Outlook Installation 2 22nd Aug 2008 10:00 PM
"Messaging Interface" has "unknown error". Re-start doesn't fix NR Microsoft Outlook Discussion 1 9th Dec 2007 07:37 AM
"Outlook 2007" +"The Messenger interface has returned an unknown error" deleteriousone Microsoft Outlook 0 7th Feb 2007 12:48 AM
What is "Microsoft Office Word" " Interface not registred" ? =?Utf-8?B?RGFuaWVsZSBQZWR1enpp?= Microsoft Outlook Discussion 0 13th Oct 2006 06:16 PM
i get " interface not registered " when i press the "send" button =?Utf-8?B?T2xpdmllcg==?= Microsoft Outlook Discussion 1 12th Feb 2006 03:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:25 PM.