Click here to Skip to main content
15,914,014 members
Home / Discussions / C#
   

C#

 
QuestionMdi Form Pin
jojoba2029-Oct-11 1:14
jojoba2029-Oct-11 1:14 
AnswerRe: Mdi Form Pin
tgurlevik29-Oct-11 2:43
tgurlevik29-Oct-11 2:43 
AnswerRe: Mdi Form Pin
Dave Kreskowiak29-Oct-11 3:15
mveDave Kreskowiak29-Oct-11 3:15 
QuestionCasting to Abstract 'parent' rather than casting to Interface ? Pin
BillWoodruff28-Oct-11 22:31
professionalBillWoodruff28-Oct-11 22:31 
AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? PinPopular
Luc Pattyn29-Oct-11 1:37
sitebuilderLuc Pattyn29-Oct-11 1:37 
GeneralRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
Not Active29-Oct-11 5:17
mentorNot Active29-Oct-11 5:17 
GeneralRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
Luc Pattyn29-Oct-11 5:45
sitebuilderLuc Pattyn29-Oct-11 5:45 
GeneralRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
BillWoodruff29-Oct-11 16:26
professionalBillWoodruff29-Oct-11 16:26 
That's a most eloquent, and intellectually satisfying answer, thanks, Luc !

If I interpret your words correctly (big IF), then I am inclined to interpret this type of use for interfaces ... beyond the obvious use as a way to establish a 'contract' that specifies what implementors of the interface must provide ... is to model shared 'behavior:' where modeling is-a, or inheritance relationships, is not an absolute requirement. As you say: "weaker form ... of separation of concerns." And more efficient ? At the least, more logically "lean and mean."

I do note the MS docs talk about interfaces in terms of expressing "related functionalities." And proscribes Interfaces as "The interface itself provides no functionality." And, of course, an Interface requires implementors to implement everything defined in the Interface.

While I am still a bit puzzled about what the 'abstract' class was intended for ... by its designers ... compared to just inheriting from a base class ... other than that it, indeed, does express is-a, or hierarchy: that's something I can certainly pursue in my books and on-line.

Since the abstract class does, as interface does, demand its consumers implement things it (optionally) wants to 'use' (via 'override'), and can, as explored here, function as a factory object; the question arises in my head as to what is a 'modal case' in which it would be 'crystal clear' that using 'abstract' as a basis for a factory class is 'best practice' ?

One clear difference that stands out: an abstract class can contain, as in my code-exploration, a static method: an interface cannot.

So, maybe, an interface is a schematic, and using abstract class as a factory object is more equivalent to a tool-chest with a schematic inside, as well as actual ready-to-go tools which can easily be modified on-the-job ?

from a happy Monkey to a wise Lion, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright

AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
Luc Pattyn29-Oct-11 17:40
sitebuilderLuc Pattyn29-Oct-11 17:40 
AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
PIEBALDconsult29-Oct-11 4:27
mvePIEBALDconsult29-Oct-11 4:27 
GeneralRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
BillWoodruff29-Oct-11 16:30
professionalBillWoodruff29-Oct-11 16:30 
GeneralRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
PIEBALDconsult29-Oct-11 17:28
mvePIEBALDconsult29-Oct-11 17:28 
AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
Abhinav S29-Oct-11 17:46
Abhinav S29-Oct-11 17:46 
AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
BobJanova30-Oct-11 23:36
BobJanova30-Oct-11 23:36 
QuestionC# linq working with list controls Pin
classy_dog28-Oct-11 14:33
classy_dog28-Oct-11 14:33 
AnswerRe: C# linq working with list controls Pin
BillWoodruff28-Oct-11 14:59
professionalBillWoodruff28-Oct-11 14:59 
GeneralRe: C# linq working with list controls Pin
classy_dog28-Oct-11 17:02
classy_dog28-Oct-11 17:02 
GeneralRe: C# linq working with list controls Pin
BillWoodruff28-Oct-11 18:57
professionalBillWoodruff28-Oct-11 18:57 
QuestionWhat does this code segment mean?? Pin
Goalie3528-Oct-11 11:01
Goalie3528-Oct-11 11:01 
AnswerRe: What does this code segment mean?? PinPopular
harold aptroot28-Oct-11 11:17
harold aptroot28-Oct-11 11:17 
QuestionBitconverter.GetBytes() issue Pin
Blubbo28-Oct-11 8:16
Blubbo28-Oct-11 8:16 
AnswerRe: Bitconverter.GetBytes() issue Pin
Mark Salsbery28-Oct-11 8:36
Mark Salsbery28-Oct-11 8:36 
AnswerRe: Bitconverter.GetBytes() issue Pin
Dennis E White28-Oct-11 9:40
professionalDennis E White28-Oct-11 9:40 
AnswerRe: Bitconverter.GetBytes() issue Pin
harold aptroot28-Oct-11 9:42
harold aptroot28-Oct-11 9:42 
QuestionWriting plugin for IE Pin
johnsson7727-Oct-11 19:44
johnsson7727-Oct-11 19:44 

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.