[gnu.g++.help] compare types

tilo@nmr.lpc.ethz.ch (Tilo Levante) (02/14/91)

assume the following classes:

class base;
class d1: public base;
class d2: public base;

base *v1;
d1 *v2;
v1 = new d1;

Is there a way to decide during runtime, wether
v1 points to a variable of type d1 or of type d2.

Or is there a way to decide wether 
  v2 = (d1*) v1;
is valid.

Thanks for any help.

Tilo 

*******************************************************************************
* Tilo Levante                            Domain: tilo@nmr.lpc.ethz.ch        *
* Institut fuer physikalische Chemie      UUCP:   ...!mcsun!chx400!ethz!tilo  *
* Eidgenoessische Technische Hochschule                                       *   
* ETH-Zentrum                             Phone:  +41/1/256-4372              *
* CH-8092 Zuerich                         Fax:    +41/1/252-3402              *
*******************************************************************************