title: How to reference and store properties of a class in another class
body: <p>I am writing a class for a device that has multiple hw inputs (one analog, two digital) and I want to use the properties from the HW class (ADC1, DI1, DI2, etc) in the constructor of my sensor class. How do I do this?</p>
  
  <p>So I have a HW class that provides me access to my hardware. There are many more inputs, but a truncated version that looks like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class HWClass
  {
      public GpioPin INPUT1;
      public GpioPin INPUT2;
      public double ADC1Value { get =&gt; ADC1(); }
      private double ADC1()
      {
          //ADC code here
      }
  }
  </code></pre>
  
  <p>I have a sensor that uses one analog and two digital inputs. I am wanting to use a class to provide some abstraction. Ideally placing the inputs into the class constructor. Currently my sensor class looks like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class sensor
  {
      private double AnalogInput;
      private GpioPin Input1;
      private GpioPin Input2;
  
      public Sensor(ref double analogInput, ref GpioPin input1, ref GpioPin input2)
      {
  
      }
  }
  </code></pre>
  
  <p>In my main class I want to be able to assign the inputs to the sensor as I have multiple of the same sensor. Something like this below:</p>
  
  <pre class="lang-cs prettyprint-override"><code>
  public class myApp
  {
      private HWClass myHardware;
  
      public myApp()
      {
          sensor sensor1 = new sensor(myHardware.ADC1Value, myHardware.Input2, myHardware.Input3)
          sensor sensor2 = new sensor(myHardware.ADC3Value, myHardware.Input5, myHardware.Input4)
  
  }
  
  </code></pre>
  
  <p>I want to be  to able store the constructor references and have a it work similar to above. How do I do this?</p>
  
  <p>Thanks!!</p>