Skip to content

Commit 5a59413

Browse files
bkoelmandennisdoomen
authored andcommitted
Rephrased based on feedback (#80)
1 parent 4985f4f commit 5a59413

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Src/Cheatsheet/Cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ NOTE: Requires Markdown Extra. See http://michelf.ca/projects/php-markdown/extra
3131
* A class or interface should have a single purpose (AV1000)
3232
* An interface should be small and focused (AV1003)
3333
* Use an interface to decouple classes from each other (AV1005)
34-
* Don’t hide inherited members with the `new` keyword (AV1010)
34+
* Don't suppress compiler warnings using the new keyword (AV1010)
3535
* It should be possible to treat a derived object as if it were a base class object (AV1011)
3636
* Don’t refer to derived classes from the base class (AV1013)
3737
* Avoid exposing the objects an object depends on (AV1014)

Src/Guidelines/1000_ClassDesignGuidelines.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ With the exception of extension method containers, static classes very often lea
4242

4343
**Note:** If you really need that static class, mark it as static so that the compiler can prevent instance members and instantiating your class. This relieves you of creating an explicit private constructor.
4444

45-
### <a name="av1010"></a> Don't hide inherited members with the new keyword (AV1010) ![](images/1.png)
45+
### <a name="av1010"></a> Don't suppress compiler warnings using the new keyword (AV1010) ![](images/1.png)
4646

47-
Not only does the new keyword break [Polymorphism](http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming), one of the most essential object-orientation principles, it also makes sub-classes more difficult to understand. Consider the following two classes:
47+
Compiler warning [CS0114](https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0114) is issued when breaking [Polymorphism](http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming), one of the most essential object-orientation principles.
48+
The warning goes away when you add the `new` keyword, but it keeps sub-classes difficult to understand. Consider the following two classes:
4849

4950
public class Book
5051
{

0 commit comments

Comments
 (0)