Click here to Skip to main content
15,910,877 members
Home / Discussions / C#
   

C#

 
GeneralMy vote of #3 ... Re: How set the background of an MDI container window? PinPopular
BillWoodruff29-Oct-11 17:37
professionalBillWoodruff29-Oct-11 17:37 
AnswerRe: How set the background of an MDI container window? Pin
phil.o29-Oct-11 23:15
professionalphil.o29-Oct-11 23:15 
GeneralRe: How set the background of an MDI container window? Pin
Dave Kreskowiak30-Oct-11 3:23
mveDave Kreskowiak30-Oct-11 3:23 
AnswerRe: How set the background of an MDI container window? Pin
Ravi Bhavnani30-Oct-11 12:06
professionalRavi Bhavnani30-Oct-11 12:06 
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 
In this recent QA thread[^], is an example of creating a "class factory" based on an Interface, and then making classes that inherit from that Interface, and then, in the factory method, returning an instance of one of the inheritors cast to the Interface type.

I had set out to see, before reading Abhinav's comment on this thread, later followed by a code example, if I could achieve the same thing via use of an Abstract class definition, and, to my surprise, found that I could.

The curious thing being that I actually believed my code did not work ... until I saw Abhinav's code, and then went into my code, and set a break-point, and found I was indeed returning "pre-cast" objects from my factory method in the same way the use of the 'interface technique' would do Smile | :)

So, why am I raising a question here ? Because: I am curious what the implications of making an implementation of a "factory class" based on using an Abstract class rather than an Interface are: is it a "bad practice," is it ever preferred as a technique over using an Interface ?

You can see the tested C# WinForms code for the 'abstract' based factory class solution here[^], and I will truly appreciate any comments, or guidance.

thanks, 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 ? 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 
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?? Pin
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 

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.