Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-22-2006, 05:51 AM   #1 (permalink)
nesvarbu
Registered User
 
Join Date: Aug 2004
Posts: 6
nesvarbu is on a distinguished road
Post get object's instance

How do I get object's instance just having his name?
nesvarbu is offline   Reply With Quote
Old 04-22-2006, 09:24 AM   #2 (permalink)
kyoryu
Registered User
 
Join Date: Apr 2003
Posts: 34
kyoryu is on a distinguished road
Using which API? What exactly are you trying to do?
kyoryu is offline   Reply With Quote
Old 04-22-2006, 01:29 PM   #3 (permalink)
AssKoala
Anti-Zealot
 
AssKoala's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 72
AssKoala is on a distinguished road
Send a message via AIM to AssKoala Send a message via MSN to AssKoala Send a message via Yahoo to AssKoala
Do you mean you have a class, say, named "Box" and you want to find a specific instance of "Box"?
__________________
If you always think like an expert, you'll always be a beginner. | "A handful of knowledgeable people is more effective than an army of fools" -Writing Secure Code, 2nd Ed.
AssKoala is offline   Reply With Quote
Old 04-22-2006, 02:05 PM   #4 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
You need a compiler that supports RTTI and then use
PHP Code:
typeid(*this).name(); 
DJMaze is offline   Reply With Quote
Old 04-22-2006, 11:44 PM   #5 (permalink)
nesvarbu
Registered User
 
Join Date: Aug 2004
Posts: 6
nesvarbu is on a distinguished road
I'm using borland c++ 6.
For example I have 20 checkboxes, and I have this function:
Code:
void Test(int id) // where id is the number of checkbox 
{
   //here I need to check the checkbox, for example if id is 17 then
   //the code should be CheckBox17->Checked = true;
   //the problem is that I don't know how many checkboxes are so
   //I can't use 'if' statement or 'case' statement
   //the code should be smth like: CheckBox+id->Checked = true;
   //I know its not correct but hope you get the question?
}
nesvarbu is offline   Reply With Quote
Old 04-23-2006, 04:54 AM   #6 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
Put all checkboxes in a TList and run thru it.
Code:
TList checkboxes = new TList()
TCheckbox cb;
for (int i=0; i<10; ++i) {
    cb = new TCheckBox();
    checkboxes->ad(cb);
}

for (int i=0; i<10; ++i) {
    cb = (TCheckBox)checkboxes->get(i);
    cb->Checked = true;
}
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Game project. I need some help. Rafkin Platform/API C++ 5 12-15-2005 09:16 PM
TIP (5 minute read): remainder on const objects Valmont Standard C, C++ 1 05-18-2005 08:22 PM


All times are GMT -8. The time now is 10:26 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting