title: Javascript to C++: Object Equivalent?
body: <p>I've been tasked with converting some code from javascript to C++.  While I'm decently familiar with Javascript, I'm pretty inexperienced with C++.</p>
  
  <p>The javascript code heavily makes use of objects. For example the following code is used to convert angles from degrees to any other specified unit:</p>
  
  <pre><code>var allConversions = {
  "Angle": {
      "degrees": {
          "degrees":function(inputNum) { return inputNum*1},
          "minutes":function(inputNum) { return inputNum*60},
          "radians":function(inputNum) { return inputNum*0.0174532925},
          "revolutions":function(inputNum) { return inputNum*0.00277777778},
          "seconds":function(inputNum) { return inputNum*3600},
      }
  }
  
  exports.convertUnits= function(unitType, inUnit, outUnit, inputVal) {
      return allConversions[unitType][inUnit][outUnit] (inputVal);
  }
  </code></pre>
  
  <p>I'm wondering what is the best practice for how to create something similar in C++?  Should I try and create something similar with a struct or class?</p>