Click here to Skip to main content
16,012,168 members
Home / Discussions / C#
   

C#

 
GeneralRe: TextBox at run time Pin
Stefan Troschuetz3-Jul-04 13:16
Stefan Troschuetz3-Jul-04 13:16 
GeneralRe: TextBox at run time Pin
saud_a_k5-Jul-04 2:18
saud_a_k5-Jul-04 2:18 
GeneralRe: TextBox at run time Pin
Stefan Troschuetz5-Jul-04 2:53
Stefan Troschuetz5-Jul-04 2:53 
GeneralDesign Issue Pin
hatim_ali2-Jul-04 18:14
hatim_ali2-Jul-04 18:14 
Generaladvantage of interface/abstract class Pin
xcavin2-Jul-04 18:12
xcavin2-Jul-04 18:12 
GeneralRe: advantage of interface/abstract class Pin
Ray Cassick2-Jul-04 18:21
Ray Cassick2-Jul-04 18:21 
GeneralRe: advantage of interface/abstract class Pin
xcavin2-Jul-04 23:34
xcavin2-Jul-04 23:34 
GeneralRe: advantage of interface/abstract class Pin
Vega023-Jul-04 4:30
Vega023-Jul-04 4:30 
Remember that when a new class is defined, it can inherit from only one base class. There are no restrictions on the amount of interfaces that the class can support.

For example, consider the Arraylist Class from the .NET Framework. This class implements four different interfaces: IList, ICollection, IEnumerable, and ICloneable. By using interfaces instead of a base class, a coder may treat it as a list, a collection, an enumerable collection, and a cloneable object, whichever he sees fit.

As another example, consider two classes Amoeba and Dog. Say that Amoeba derives from Unicellular since it is so simple and that Dog derives from Mammal. Both creatures need to Eat(), but because they do so in fundamentally different ways it makes no sense to provide Eat() in a base class common to both. A much better solution would be for them to both implement IMustEat, which forces them to have an Eat() function. IMustEat (an interface) does not define how - or even if - an Eat() method works. All it says is that an Eat() method must exist.

Remember that if not explicitly specified, a class derives from System.Object. The Object Class is very elementary and provides almost no functionality. On the other hand, implementing an interface allows you to make contractual guarantees about your class.

Hope this helps!
GeneralDataGrid & ArrayList Pin
bmasephol2-Jul-04 11:03
bmasephol2-Jul-04 11:03 
GeneralDatagrid Navigation Pin
IamADotNetGuy2-Jul-04 7:30
IamADotNetGuy2-Jul-04 7:30 
GeneralRe: Datagrid Navigation Pin
saud_a_k2-Jul-04 20:07
saud_a_k2-Jul-04 20:07 
GeneralQuestion on events and local variables Pin
Flack2-Jul-04 7:14
Flack2-Jul-04 7:14 
GeneralRe: Question on events and local variables Pin
Karl 20002-Jul-04 9:10
Karl 20002-Jul-04 9:10 
GeneralSaving BMP/JPEG from Stream Pin
Emiliano2-Jul-04 6:53
Emiliano2-Jul-04 6:53 
GeneralRe: Saving BMP/JPEG from Stream Pin
Gimpy19832-Jul-04 6:58
Gimpy19832-Jul-04 6:58 
GeneralRe: Saving BMP/JPEG from Stream Pin
Emiliano2-Jul-04 8:37
Emiliano2-Jul-04 8:37 
GeneralRe: Saving BMP/JPEG from Stream Pin
Gimpy19834-Jul-04 8:28
Gimpy19834-Jul-04 8:28 
GeneralDatagrid column header Pin
Member 5877032-Jul-04 6:33
Member 5877032-Jul-04 6:33 
Generalenum question Pin
Mikke_x2-Jul-04 6:27
Mikke_x2-Jul-04 6:27 
GeneralRe: enum question Pin
Werdna2-Jul-04 12:11
Werdna2-Jul-04 12:11 
GeneralRe: enum question Pin
Mikke_x2-Jul-04 12:49
Mikke_x2-Jul-04 12:49 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 13:57
Colin Angus Mackay2-Jul-04 13:57 
GeneralRe: enum question Pin
Werdna2-Jul-04 14:38
Werdna2-Jul-04 14:38 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 14:52
Colin Angus Mackay2-Jul-04 14:52 
GeneralRe: enum question Pin
Werdna2-Jul-04 15:06
Werdna2-Jul-04 15:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.