Click here to Skip to main content
15,890,897 members
Home / Discussions / C#
   

C#

 
AnswerRe: Polymorphism Pin
Abhinav S4-Sep-11 6:26
Abhinav S4-Sep-11 6:26 
AnswerRe: Polymorphism Pin
Alan Balkany6-Sep-11 4:47
Alan Balkany6-Sep-11 4:47 
GeneralRe: Polymorphism Pin
PIEBALDconsult6-Sep-11 14:44
mvePIEBALDconsult6-Sep-11 14:44 
GeneralRe: Polymorphism Pin
Alan Balkany7-Sep-11 4:43
Alan Balkany7-Sep-11 4:43 
GeneralRe: Polymorphism Pin
PIEBALDconsult7-Sep-11 14:21
mvePIEBALDconsult7-Sep-11 14:21 
GeneralRe: Polymorphism Pin
Alan Balkany8-Sep-11 4:54
Alan Balkany8-Sep-11 4:54 
GeneralRe: Polymorphism Pin
PIEBALDconsult8-Sep-11 14:19
mvePIEBALDconsult8-Sep-11 14:19 
GeneralRe: Polymorphism Pin
Michael J. Eber8-Sep-11 7:41
Michael J. Eber8-Sep-11 7:41 
Well I think I would disagree with the statement of using Interfaces.

In the truest, textbook usage of polymorphism your are providing a different implementation of an existing implementation. While an Interface defines necessary methods/properties that must be implemented, and you can have various implementations of those methods, you don't have a base behaviour to fall back on.

So an example of Polymorphism would be a class that has a computation method that has been marked virtual.

In the base class it uses all of the various properties within the class to compute a value. In addition to this computation method are a number of setters/validators that ensure all the data is valid before you call the method. There may also be some security wrapped around everything and it has all been tested and proven functional.

You now need that class library to collect exactly the same data, and all validations, but you need to alter how the computation method behaves. So you inherit the base class and override the existing method to implement your behaviour.

In a few months you may have another use of the same base class and in that case you want the base computation to occur, but you need to return half the value. In that case, once again, you inherit the base class, override the method, call the base computation and then return the value returned by 2.

What you gain in the polymorphism model is all of the functionality of the base class that does NOT have to be tested (since it is already tested and working). All you have to test is your new computation code. Thus you gain functionality and minimize the testing needed to accomplish your goal.
Software Zen: delete this;

GeneralRe: Polymorphism Pin
PIEBALDconsult8-Sep-11 14:22
mvePIEBALDconsult8-Sep-11 14:22 
QuestionC# PSAPI_VERSION. and sevral other question [modified] [Partialy Solved] Pin
Saksida Bojan3-Sep-11 23:12
Saksida Bojan3-Sep-11 23:12 
AnswerRe: C# PSAPI_VERSION. and sevral other question [modified] [Partialy Solved] Pin
BobJanova4-Sep-11 23:11
BobJanova4-Sep-11 23:11 
GeneralRe: C# PSAPI_VERSION. and sevral other question [modified] [Partialy Solved] Pin
Saksida Bojan5-Sep-11 5:45
Saksida Bojan5-Sep-11 5:45 
GeneralRe: C# PSAPI_VERSION. and sevral other question [modified] [Partialy Solved] Pin
BobJanova5-Sep-11 5:51
BobJanova5-Sep-11 5:51 
Question8 directional chain code for monochrome images Pin
dookeybre3-Sep-11 16:03
dookeybre3-Sep-11 16:03 
AnswerRe: 8 directional chain code for monochrome images Pin
OriginalGriff3-Sep-11 21:19
mveOriginalGriff3-Sep-11 21:19 
GeneralRe: 8 directional chain code for monochrome images Pin
dookeybre3-Sep-11 21:21
dookeybre3-Sep-11 21:21 
QuestionDiscovering and Accessing IP Cameras Pin
AmbiguousName3-Sep-11 0:58
AmbiguousName3-Sep-11 0:58 
AnswerRe: Discovering and Accessing IP Cameras Pin
Abhinav S3-Sep-11 6:00
Abhinav S3-Sep-11 6:00 
QuestionEmail Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
bigz_10002-Sep-11 21:46
bigz_10002-Sep-11 21:46 
AnswerRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
Mehdi Gholam2-Sep-11 21:50
Mehdi Gholam2-Sep-11 21:50 
GeneralRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
bigz_10002-Sep-11 22:04
bigz_10002-Sep-11 22:04 
GeneralRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
Dave Kreskowiak3-Sep-11 8:40
mveDave Kreskowiak3-Sep-11 8:40 
GeneralRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
bigz_10004-Sep-11 0:10
bigz_10004-Sep-11 0:10 
AnswerRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
jschell3-Sep-11 10:39
jschell3-Sep-11 10:39 
GeneralRe: Email Sender :the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
bigz_10004-Sep-11 0:11
bigz_10004-Sep-11 0:11 

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.