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

C#

 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 10:39
mvePIEBALDconsult8-Dec-09 10:39 
GeneralRe: To be liberal or conservative with virtual methods... Pin
harold aptroot8-Dec-09 10:41
harold aptroot8-Dec-09 10:41 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 10:47
mvePIEBALDconsult8-Dec-09 10:47 
GeneralRe: To be liberal or conservative with virtual methods... Pin
harold aptroot8-Dec-09 10:55
harold aptroot8-Dec-09 10:55 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 10:57
mvePIEBALDconsult8-Dec-09 10:57 
GeneralRe: To be liberal or conservative with virtual methods... Pin
Pete O'Hanlon8-Dec-09 11:10
mvePete O'Hanlon8-Dec-09 11:10 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 13:33
mvePIEBALDconsult8-Dec-09 13:33 
AnswerRe: To be liberal or conservative with virtual methods... Pin
Jimmanuel8-Dec-09 10:58
Jimmanuel8-Dec-09 10:58 
If you make it virtual now what happens later on (days, months, years) when you want to modify it? You look at the method, see it's virtual and ask yourself "Has anything overridden this method? If so will this change break those child classes?".

If you make everything virtual automatically then the only way to answer that question is to go through your code base and look. If you only make methods virtual when they need to be then you already know the answer: "Nothing has overridden this because it can't be overridden".

Also, later on it's trivial to add the modifier but difficult to add it for the same reason. Adding it can't break any other code, removing it can.

The same can be said about any question involving code security. In general the safest bet is to go with the most restrictive permissions you can and then loosen them up as needed. Loosening permissions is easy, tightening them is hard.



GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 11:11
mvePIEBALDconsult8-Dec-09 11:11 
GeneralRe: To be liberal or conservative with virtual methods... Pin
Jimmanuel8-Dec-09 11:21
Jimmanuel8-Dec-09 11:21 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 11:52
mvePIEBALDconsult8-Dec-09 11:52 
GeneralRe: To be liberal or conservative with virtual methods... Pin
Jimmanuel8-Dec-09 12:44
Jimmanuel8-Dec-09 12:44 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 13:03
mvePIEBALDconsult8-Dec-09 13:03 
GeneralRe: To be liberal or conservative with virtual methods... [modified] Pin
PIEBALDconsult8-Dec-09 14:46
mvePIEBALDconsult8-Dec-09 14:46 
GeneralRe: To be liberal or conservative with virtual methods... Pin
Jimmanuel8-Dec-09 15:34
Jimmanuel8-Dec-09 15:34 
GeneralRe: To be liberal or conservative with virtual methods... [modified] Pin
PIEBALDconsult8-Dec-09 16:26
mvePIEBALDconsult8-Dec-09 16:26 
AnswerRe: To be liberal or conservative with virtual methods... Pin
Daniel Grunwald8-Dec-09 15:05
Daniel Grunwald8-Dec-09 15:05 
GeneralRe: To be liberal or conservative with virtual methods... Pin
PIEBALDconsult8-Dec-09 17:44
mvePIEBALDconsult8-Dec-09 17:44 
QuestionCheckedListBox state to property Pin
BDJones8-Dec-09 7:06
BDJones8-Dec-09 7:06 
AnswerRe: CheckedListBox state to property Pin
PIEBALDconsult8-Dec-09 7:32
mvePIEBALDconsult8-Dec-09 7:32 
AnswerRe: CheckedListBox state to property Pin
dan!sh 8-Dec-09 8:03
professional dan!sh 8-Dec-09 8:03 
QuestionRe: CheckedListBox state to property Pin
BDJones8-Dec-09 8:44
BDJones8-Dec-09 8:44 
AnswerRe: CheckedListBox state to property Pin
PIEBALDconsult8-Dec-09 10:30
mvePIEBALDconsult8-Dec-09 10:30 
AnswerRe: CheckedListBox state to property Pin
dan!sh 8-Dec-09 16:27
professional dan!sh 8-Dec-09 16:27 
Questionany other better way for window form to interact with excel? Pin
neodeaths8-Dec-09 4:39
neodeaths8-Dec-09 4:39 

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.