Hacker News new | ask | show | jobs
by mikulas_florek 3374 days ago
You can write the exact same wrong code in e.g. C#

  public class Meters { public int x; }
  public class Yards { public int x; }
  public class Kilograms { public int x; }

  Meters m = ...
  Yards y = ...
  Kilograms k = ...
  k.x = m.x + y.x;
all my sugestions for C are basically the same in C#

  - do not use builtin operators in C# for that instead create new functions, e.g. addMeters()
  - hide the int in *.c file == make it private in c#