C# style Inheritance and Interfaces


F

Flavian Mwasi

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);

}





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?



I was wondering., wouldn't it be better to use the more clearer VB-style or
Java-style methods of invoking inheritance and interface? After all this is
not the era of the criptic C++ style way of programming. I think this would
remove the confusion a great deal.



e.g.



interface ItextBox implements Icontrol {}



AND

public class EditBox inherits Icontrol {}





etc.
 
Ad

Advertisements

N

Niki Estner

Flavian Mwasi said:
I'm a bit confused about the way Inheritance and Interfaces are constructed
in C#.

Why, it's done exactly the same way as in VB or Java - only the syntax is
different.
I was wondering., wouldn't it be better to use the more clearer VB-style or
Java-style methods of invoking inheritance and interface?
...

I'm not sure if I got you? To me this sounds like you're merely complaining
about the ":"???
Or do you want to have C# with Java syntax (then use J#)?

If you're learning C#, it's ok if you don't understand all of it's syntax
yet - but that doesn't make it cryptic.

Niki
 

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

Top