Skip to content

Commit

Permalink
Sealing
Browse files Browse the repository at this point in the history
Classes should have two possibilities: extendable and non-instatiatable OR non-extendable and instantiatable.
Classes MUST ALWAYS have either abstract or sealed as attributes for the class.

This helps drive good object oriented practices and avoids a lot of complications that appear when classes unintended for extension start to get extended.
  • Loading branch information
Fyzxs committed Jun 15, 2018
1 parent 7830cd2 commit 6d38bf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AddTwoInts/AddTwoIntsTests.cs
Expand Up @@ -28,7 +28,7 @@ public abstract class Integer
protected abstract int Value();
}

public class IntegerOf : Integer
public sealed class IntegerOf : Integer
{
private readonly int _origin;

Expand All @@ -37,7 +37,7 @@ public class IntegerOf : Integer
protected override int Value() => _origin;
}

public class Sum : ISum
public sealed class Sum : ISum
{
private readonly int _augend;
private readonly int _addend;
Expand Down

0 comments on commit 6d38bf3

Please sign in to comment.