diff options
Diffstat (limited to 'cpp/demo/Ice/value/Client.cpp')
-rw-r--r-- | cpp/demo/Ice/value/Client.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cpp/demo/Ice/value/Client.cpp b/cpp/demo/Ice/value/Client.cpp index 1b5c6ca7591..7535b690e96 100644 --- a/cpp/demo/Ice/value/Client.cpp +++ b/cpp/demo/Ice/value/Client.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <Value.h> +#include <ValueI.h> #include <ObjectFactory.h> using namespace std; @@ -156,6 +157,24 @@ ValueClient::run(int argc, char* argv[]) derived->printUppercase(); cout << '\n' + << "Now let's make sure that slice is preserved with [\"preserve-slice\"]\n" + << "metadata. We create a derived type on the client and pass it to the\n" + << "server, which does not have a factory for the derived type. We do a\n" + << "dynamic_cast<> to make sure we can still access the derived type when\n" + << "it has been returned from the server.\n" + << "[press enter]\n"; + cin.getline(c, 2); + + ClientPrinterPtr clientp = new ClientPrinterI; + clientp->message = "a message 4 u"; + communicator()->addObjectFactory(factory, Demo::ClientPrinter::ice_staticId()); + + derivedAsBase = initial->updatePrinterMessage(clientp); + clientp = ClientPrinterPtr::dynamicCast(derivedAsBase); + assert(clientp); + cout << "==> " << clientp->message << endl; + + cout << '\n' << "Finally, we try the same again, but instead of returning the\n" << "derived object, we throw an exception containing the derived\n" << "object.\n" |