Re: C# Inheritance and Interfaces
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 05/31/04
- Next message: Chris: "Re: how to use MS Word from client ?"
- Previous message: Chris: "Re: how to use MS Word from client ?"
- In reply to: Flavian Musyoka Mwasi: "C# Inheritance and Interfaces"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 May 2004 09:20:02 +0100
Flavian Musyoka Mwasi <musyoka7@hotmail.com> wrote:
> I'm a novice programmer just beginning to learn the new C#
> language.
>
> I'm a bit confused about the way Inheritance and
> Interfaces are constructed in C#. The following examples
> may help clarify my confusion:
>
> interface IControl
> {
> void Paint();
>
> }
>
> interface ITextBox: IControl
> {
> void SetText(string text);
> }
>
> public class IControl
> {
> void SetText(string text);
> }
Hang on - you've now got two types called IControl - one an interface,
one a class. That's a really bad idea. Was it what you intended.
> public class EditBox : IControl
> {
> public void Paint() {...}
> public void Bind(Binder b) {...}
> }
>
> Can the designers of the language ponder over this and
> maybe think of a way to remove this confusion in future
> releases of the language?
What confusion?
> I was wondering., wouldn't it be better to use the more
> clearer VB-style or Java-style methods of invoking
> inheritance and interface?
Interfaces in C# are very similar to interfaces in Java.
I'm still missing what your actual problem with how interfaces work in
C# is.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Chris: "Re: how to use MS Word from client ?"
- Previous message: Chris: "Re: how to use MS Word from client ?"
- In reply to: Flavian Musyoka Mwasi: "C# Inheritance and Interfaces"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|