Interface vs memebers

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
I would like to know if it is possible to inforce specific members
implementation just as methods inforcment of methods implementaion in
Interface?
Thank u!
 
Hello csharpula,

not quite understood what u want.
Force specific method from interface to be impemented?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


cc> Hello,
cc> I would like to know if it is possible to inforce specific members
cc> implementation just as methods inforcment of methods implementaion
cc> in
cc> Interface?
cc> Thank u!
cc>
cc>
 
csharpula csharp said:
I would like to know if it is possible to inforce specific members
implementation just as methods inforcment of methods implementaion in
Interface?

Methods *are* members (as are properties and events, which can also be
part of interfaces). Do you mean enforcing fields? If so, there isn't a
way of doing it - and a good thing too, as it's generally a bad idea to
make fields non-private anyway.
 
csharpula said:
Hello,
I would like to know if it is possible to inforce specific members
implementation just as methods inforcment of methods implementaion in
Interface?

You can require implementation of properties:

interface IMyIntf
{
int MyProp { get; set; }
}

-- Barry
 
Hi,

As the other said it's not clear what you want.

You could make your class abstract and thus force the implementation of
members in a derived class.

If this is not what you want, just post back with more details
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top