 |
|  |
 |
|
vovan
|
|
Okay, first off: I have been spoiled by Java. 

So, now, I am going back to programming in C++ and I am having a slight problem. In Java I made much use of the instanceof operator to determine which derived class an object was an instance of. Now, sure enough, I was coding in C++ the other day and wanted to use that same thing, but... It looks like there is no such thing. So the question is:
Suppose I have some base class, and a bunch of derived classes. I also have a method that should process an object. And that object can be an instance of any of the derived classes. So, I specify the type of the parameter as the base class. However, for bookkeeping purposes, I would still need to know exactly which of the derived classes the parameter is an instance of. Is there any way at all to do it? (Short of putting an identifyier string member into the base class and initializing it to different values in the derived classes?)
Any help would be appreciated. 
|
|
|  |
 |
|
vovan
|
|
quote: Originally posted by Sir Ralph
Nobody would put a identifier string in every instance. Better to define a pure method in the base class. |
Right, that's what I meant. Sorry if I didn't make it clearer...
|
|
|  |
 |
|
raghar
|
|
I wish somewhere else.
Oct 2002 time: 05:27
|
|
So because a lot of C programmers is here. A little question.
So imagine DLL file. I know name of method in it and I would like to call it from Java. I know I need to have wrapper by JNI however how can I do wrapper. (There might be a little problem if I find no compiller. )
Could you write a compilable example? Use NewLibrary.DLL as name of library.
|
|
|  |
All times are GMT. The time now is 05:27. Apolyton Time is 00:27. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|