hi
there are two ways of doing this
first is you can take one static data member in class and
initialze it with 0 and increment it in the constructor
and check if the value of the staic variable is greater
than one generate an error. hope this will help u.
second one is use singleton keyword (this i never tried
in c# but this works in c++).
>-----Original Message-----
>
>Does anyone has an answer to this?
>How can u write a class and restrict that only one
object
>can be created?
>
>.
>
|