Click here to Skip to main content
15,919,121 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Freeing the CObject Pin
pathakr23-May-06 20:30
pathakr23-May-06 20:30 
QuestionNamespace Extensions and Handling F3/CTRL+F by our application Pin
Vasudevan Deepak Kumar23-May-06 19:03
Vasudevan Deepak Kumar23-May-06 19:03 
QuestionGradient RoundRect Pin
HakunaMatada23-May-06 18:56
HakunaMatada23-May-06 18:56 
AnswerRe: Gradient RoundRect Pin
Nibu babu thomas23-May-06 19:04
Nibu babu thomas23-May-06 19:04 
AnswerRe: Gradient RoundRect Pin
Hamid_RT23-May-06 19:18
Hamid_RT23-May-06 19:18 
Questioncontrolling the creation of objects Pin
kumar_mk23-May-06 18:47
kumar_mk23-May-06 18:47 
AnswerRe: controlling the creation of objects Pin
_AnsHUMAN_ 23-May-06 19:15
_AnsHUMAN_ 23-May-06 19:15 
AnswerRe: controlling the creation of objects Pin
Nibu babu thomas23-May-06 19:16
Nibu babu thomas23-May-06 19:16 
kumar_windows wrote:
Is there any way i can control the creation of the objects for a class, like for example we have a singleton class for which we can create only a single instance, likewise i wanna limit the creation of objects say only 2 objects for a class or only 3 object for the class


You can have a static variable to count the number of instances created. Increment variable in the constructor decrement in the destructor. Hence keeping track of the objects created.

The caveat is that you cannot entirely prevent the creation of an object but you can throw exceptions if object count increases beyond the limit that you have set.


Nibu thomas
A Developer

Programming tips[^]  My site[^]

QuestionHow to Get Current System ip Pin
bujji_bec23-May-06 18:38
bujji_bec23-May-06 18:38 
AnswerRe: How to Get Current System ip [modified] Pin
Nibu babu thomas23-May-06 18:52
Nibu babu thomas23-May-06 18:52 
AnswerRe: How to Get Current System ip Pin
Hamid_RT23-May-06 19:03
Hamid_RT23-May-06 19:03 
QuestionMy Access DB Got Mad! Pin
Hamed Musavi23-May-06 18:21
Hamed Musavi23-May-06 18:21 
NewsC++ vs C# vs C++/CLI Performance [modified] Pin
Ed K23-May-06 17:08
Ed K23-May-06 17:08 
GeneralRe: C++ vs C# vs C++/CLI Performance [modified] Pin
bob1697223-May-06 17:36
bob1697223-May-06 17:36 
GeneralRe: C++ vs C# vs C++/CLI Performance [modified] Pin
Maxwell Chen23-May-06 18:06
Maxwell Chen23-May-06 18:06 
GeneralRe: C++ vs C# vs C++/CLI Performance [modified] Pin
Sarath C23-May-06 18:13
Sarath C23-May-06 18:13 
GeneralRe: C++ vs C# vs C++/CLI Performance [modified] Pin
Maxwell Chen23-May-06 18:21
Maxwell Chen23-May-06 18:21 
AnswerRe: C++ vs C# vs C++/CLI Performance [modified] Pin
Ed K24-May-06 6:49
Ed K24-May-06 6:49 
GeneralRe: C++ vs C# vs C++/CLI Performance [modified] Pin
bob1697224-May-06 18:01
bob1697224-May-06 18:01 
Questionprogressbar and xp themes help Pin
locoone23-May-06 17:07
locoone23-May-06 17:07 
AnswerRe: progressbar and xp themes help Pin
Nibu babu thomas23-May-06 17:24
Nibu babu thomas23-May-06 17:24 
GeneralRe: progressbar and xp themes help Pin
locoone24-May-06 13:25
locoone24-May-06 13:25 
AnswerRe: progressbar and xp themes help Pin
Hamid_RT23-May-06 19:23
Hamid_RT23-May-06 19:23 
GeneralRe: progressbar and xp themes help Pin
locoone24-May-06 13:54
locoone24-May-06 13:54 
QuestionPrinting CEditView Pin
richard stott23-May-06 16:53
richard stott23-May-06 16:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.