Archived
This forum has been archived. Please start a new discussion on GitHub.
About Classes as Unions
in Help Center
the .ice file is
class base
{
int d;
};
class stringbase extends base
{
string s;
};
class Hello
{
nonmutating void sayHello(base i);
idempotent void shutdown();
};
....
In the implement file , in the function
void sayHello(base i);
How can I dynamic_cast or static_cast the base pointer to stringbase pointer?
class base
{
int d;
};
class stringbase extends base
{
string s;
};
class Hello
{
nonmutating void sayHello(base i);
idempotent void shutdown();
};
....
In the implement file , in the function
void sayHello(base i);
How can I dynamic_cast or static_cast the base pointer to stringbase pointer?
0
Comments
-
In C++, you can use the smart pointer dynamicCast method:
void sayHello(basePtr i) { stringbasePtr s = stringbasePtr::dynamicCast(i); }
In Java, you can just do a regular dynamic cast:void sayHello(base i) { stringbase s = (stringbase)i; }
Benoit.0 -
It's ok
Thank a lot .0