Note that there are some explanatory texts on larger screens.

plurals
  1. POBest way of organising load/save functions in terms of static/non-static
    primarykey
    data
    text
    <p>I have a class which defines a historical extraction on a database:</p> <pre><code>class ExtractionConfiguration { string ExtractionName; time ExtractionStartTime; time ExtractionEndTime; // Should these functions be static/non-static? // The load/save path is a function of ExtractionName void SaveConfigruation(); void LoadConfiguration(); } </code></pre> <p>These ExtractionConfigurations need to be saved to/loaded from disk. What is the best way of organising the save/load functions in terms of static/non-static? To me, it is clear that SaveConfiguration() should be a member function. However with LoadConfiguration(), does it make more sense to call</p> <pre><code>ExtractionConfiguration newExtraction; newExtraction.LoadConfiguration(); </code></pre> <p>and have a temporary empty instance or make the load function static</p> <pre><code>static ExtractionConfiguration LoadConfiguration(string filename); </code></pre> <p>and just call</p> <pre><code>ExtractionConfiguration newExtraction = ExtractionConfiguration::LoadConfiguration(filename); </code></pre> <p>which feels neater to me, but breaks the 'symmetry' of the load/save mechanism (is this even a meaningful/worthwhile consideration?).</p> <p>I suppose asking for the 'best' answer is somewhat naive. I am really trying to get a better understanding of the issues involved here.</p> <p>P.S. This is my first question on SO, so if I have not presented it correctly, please let me know and I will try and make the problem clearer.</p>
    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.
 

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