c++ Singleton by reference use -
 I have read some wiki in stack overflow, and I have written the following header file for my randomizer class:    I have also applied some methods inside the classroom, such as the next and the like.    I am unsure about how to give examples of this singleton class, that is how to write a test drive in the main ()?    I tried:    The compiler says some errors:    Thanks for the help.       You are saying that you want a singleton but:    This creates a new example of   Here you are trying to copy a single from a singleton, which you have explicitly declared private.    Perhaps you want to use it:    Probably a  
 int main () {Randomizer r; R = Radiimizer :: Example (); }    
 in the Randomizer.cpp file included: 11: 0: Randomizer.h: in the function ??? ? Int main (int, char **) a ????: Randomizer.h: 22: 9: error: a randomize :: Randomizer () a ???? Private is random (zero) {}; ^ Randomizer.cpp: 56: 16: Error: Randomomarer in this context; ^ Randomizer.cpp file included in: 11: 0: Randomizer.h: 25: 14: Error: An empty zero random :: operator = (Const Randimizer & amp;) ??? Private Zero operator is = (Radiimizer brace & amp;); ^ Randomizer.cpp: 57: 7: Error: R = RandOzer :: Example () in this context; ^    
 Randomizer R;    Randomizer  by attempting to call the default blank constructor. So you are not using it as a singleton, in addition you have declared the constructor private.   
 r = randomizer :: instance ();    
 Randisoner & amp; R = Radiimizer :: Example ()    const randomm and amp; For example ()  method that is a temporary reference if the randomizer does not have a visible position in itself.   
 
  
Comments
Post a Comment