Browse files

Added IntergerOf

IntegerOf as a class is how we wrap primitive data values into an object. This allows us to use objects in our code and not pass around data structures.
We are doing object oriented programming, not data structure programming. We remove the data storage aspect by encapsulating the data into a class with controlable behavior.

Other reasons to not use the data structure - God Class. Does MANY things.
  • Loading branch information...
Fyzxs committed Jun 15, 2018
1 parent 191db71 commit 4f9a23d8cbe1a60fab2310445ac853c9a12147fa
Showing with 9 additions and 0 deletions.
  1. +9 −0 AddTwoInts/AddTwoIntsTests.cs
@@ -28,6 +28,15 @@ public abstract class Integer
protected abstract int Value();

public class IntegerOf : Integer
private readonly int _origin;

public IntegerOf(int origin) => _origin = origin;

protected override int Value() => _origin;

public class Sum : ISum
private readonly int _augend;

0 comments on commit 4f9a23d

Please sign in to comment.