Finding the existence of a class 
Author Message
 Finding the existence of a class

Bhanoji,

I know of no portable way of doing this, unless you are writing the class
yourself.

If you *are* writing the class, then it's really a simple matter:

Create a static class member variable (unsigned long) that is initialized
to zero.  In the class's constructor, increment this variable.  In the
destructor, decrement it.  You can then check the variable at any time to
see how many instances of the class are in existence.  You can also provide
a public static member function in your class to provide this information
to outsiders...

---
Scott Smith



Quote:
> I have a third party library which has lot of classes.  I would like to
> know whether one class was instantiated already or not at run time.  Is
> there any way I can find by knowing the class name.



Tue, 06 Jul 1999 03:00:00 GMT  
 Finding the existence of a class


Fri, 19 Jun 1992 00:00:00 GMT  
 Finding the existence of a class



Quote:
> I have a third party library which has lot of classes.  I would like to
> know whether one class was instantiated already or not at run time.  Is
> there any way I can find by knowing the class name.

Hi
  If your code is doing the instantiation of the foreign class at some
point in time and you want to figure out whether it is around at another
point, use a wrapper class like this

class ForeignWrapper {
public:
   ForeignWrapper() { pForeign_ = new Foreign(); created_ = true;  }
   ~ForeignWrapper();
  static bool IsCreated(){ return created_;}
private:
static bool created_;
Foreign * pForeign_;
 } ;

Vivek



Sun, 18 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Finding the existence of a class

2. Finding the existence of a class

3. Finding the existence of a class

4. Find existence of a process in win95

5. Class Wizard doesn't find classes?

6. Class Template problem: The linker can't find my class template

7. Can not find class in class wizard

8. Check for existence of a file in C

9. test for file existence?

10. How to check the existence of a file?

11. check the existence of process via a C fct

12. check file existence

 

 
Powered by phpBB® Forum Software