Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Limit Object Instances

Reply
Thread Tools

Re: Limit Object Instances

 
 
Dimitris Kamenopoulos
Guest
Posts: n/a
 
      06-26-2003
amitpethkar wrote:

> Hi All,
>
> I want to know is it possible to limit the instances of C++ class.


Yes, it is.

> for example
> Suppose there is 1 instance created of a class and if you create
> other instances they will refer to 1st instance itself instead of
> constructing more objects


This special (and most useful) case is called "Singleton Design Pattern".
For single-threaded applications the implementation is reasonably
straightforward. Google for it, or better, check out Design Patterns by
Gamma et al. (ISBN 0201633612) to learn more about this and other design
patterns.

 
Reply With Quote
 
 
 
 
amitpethkar
Guest
Posts: n/a
 
      06-27-2003
Dimitris Kamenopoulos <> wrote in message news:<bdeshs$2jmi$>...
> amitpethkar wrote:
>
> > Hi All,
> >
> > I want to know is it possible to limit the instances of C++ class.

>
> Yes, it is.
>
> > for example
> > Suppose there is 1 instance created of a class and if you create
> > other instances they will refer to 1st instance itself instead of
> > constructing more objects

>
> This special (and most useful) case is called "Singleton Design Pattern".
> For single-threaded applications the implementation is reasonably
> straightforward. Google for it, or better, check out Design Patterns by
> Gamma et al. (ISBN 0201633612) to learn more about this and other design
> patterns.


Thank you very much. I learnt concept called Singleton design pattern .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any Way to Limit Instances of a Web User Control Element? Jonathan Wood ASP .Net 6 05-04-2009 11:43 PM
dicts,instances,containers, slotted instances, et cetera. ocschwar@gmail.com Python 8 01-29-2009 09:52 AM
Platform limit of 64 STP instances DM Cisco 1 09-28-2006 10:14 PM
list of class instances within a list of a class instances John Wohlbier Python 2 02-22-2004 08:41 AM
Re: Limit Object Instances Dhruv C++ 6 07-02-2003 08:06 AM



Advertisments