copy constructor
-
-
Then it won't compile.
Maxwell Chen
-
Then it won't compile.
Maxwell Chen
It won't compile if somebody that uses your class tries to use the copy constructor. So, that was the purpose of his question no ? Preventing people to copy the class. Maybe I misunderstood the question :doh:
Cédric Moonen Software developer
Charting control -
It won't compile if somebody that uses your class tries to use the copy constructor. So, that was the purpose of his question no ? Preventing people to copy the class. Maybe I misunderstood the question :doh:
Cédric Moonen Software developer
Charting controlMaybe your suggestion is what he needed. I was thinking if he was trying to seek a method which redirects copy ctor to other methods ...
Maxwell Chen
-
It won't compile if somebody that uses your class tries to use the copy constructor. So, that was the purpose of his question no ? Preventing people to copy the class. Maybe I misunderstood the question :doh:
Cédric Moonen Software developer
Charting controlCedric Moonen wrote:
Maybe I misunderstood the question
I think not. The same guy asked about the Singleton pattern a few threads down and the correct way to implement the Singleton pattern is to declare constructors, copy constructor and the assignment operator as protected or private. A compile time error is expected if the class implemented as a singleton is used in a way it shouldn't. -- Roger
_It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"_
-
Maybe your suggestion is what he needed. I was thinking if he was trying to seek a method which redirects copy ctor to other methods ...
Maxwell Chen
Maxwell Chen wrote:
I was thinking if he was trying to seek a method which redirects copy ctor to other methods ...
In Other Method! :confused:
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
Hi !!! If you don't define copy constructor in your class, the compiler creates one automatically. YOu cannot prevent that the compiler creates one, but you can implement one with aan empty body. By !!! -:KNOX:-