Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 04-09-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
About Classes as Unions

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?
Reply With Quote
  #2 (permalink)  
Old 04-09-2004
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
In C++, you can use the smart pointer dynamicCast method:

Code:
   void sayHello(basePtr i)
   {
         stringbasePtr s  = stringbasePtr::dynamicCast(i);
   }
In Java, you can just do a regular dynamic cast:

Code:
   void sayHello(base i)
   {
         stringbase s = (stringbase)i;
   }
Benoit.
Reply With Quote
  #3 (permalink)  
Old 04-09-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
It's ok
Thank a lot .
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB 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
a question about Classes as Unions fengxb Help Center 9 04-11-2007 10:00 AM
Deprecating Classes in ICE kamran Help Center 1 09-07-2006 06:57 PM
C# classes semerich Comments 3 02-08-2006 09:23 AM
Sequence of 'unions'? dwolfe5272 Help Center 6 10-18-2004 05:38 PM
Why operations on classes? bernard Comments 1 02-21-2003 11:36 AM


All times are GMT -4. The time now is 12:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.