Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To expose the instance of <code>Map</code> in your <code>MapController</code> either make it a public field, or put it in a property. example:</p> <pre><code>public class MapController { public MapController() { } //here you make it "public" so it is visible to outside classes public Map map = new Map(); // the rest of your code for this class... </code></pre> <p>Then to access that instance (assuming you are holding onto an instance of the controller)</p> <pre><code>var controller = new MapController(); controller.map.rows = 5; // now you can access that instance of map. controller.map.rows = 123; </code></pre> <p>Now, to inject the Map into the controller (meaning that it is newed up somewhere else in your code, and the same instance can then be shared accross multiple classes using similar injection procedures) you would do something like this...</p> <pre><code>public class MapController { //here you make it "private" cause it doesn't need to be public anymore, //you also don't new it up here, you are passing in a new on during construction. private Map map; public MapController(Map map) { this.map = map } // the rest of your code for this class... </code></pre> <p>Now in the code where you new up the objects and stuff...</p> <pre><code>var map = new Map(); var controller = new MapController(map); map.rows = 5; // now you can access that instance of map. map.rows = 123; // and you can easily share that same instance with other classes var otherClass = new SomeOtherClassThatNeedsTheMap(map); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload