Home Help Center

How to use Slice defined Types in another definition

Hi there,

I've defined few types in Slice in one Java module. I'll need to use these types in a Slice definition of a different module.

Java Module Foo
<CODE>
module Foo {
class FooClass {
string foostr;
};
};
</CODE>

Java Module Bar
<CODE>
module Bar {
class BarClass {
FooClass foo;
};
};
</CODE>

Any help is greatly appreciated?

Thanks,
Venkat

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    In Slice code, use Foo::FooClass, just like in C++. In Java code, use Foo.FooClass.
  • Venkat SeethVenkat Seeth Member ✭✭
    Marc, thanks for the reply.

    slice2java compiler complains that:
    `com' is not defined.

    Should I use "::" as the package separator instead of "."?

    Venkat
  • Venkat SeethVenkat Seeth Member ✭✭
    One more clarification, the slice definitions for Foo and bar are in different files, namely Foo.ice and Bar.ice in separate namespaces.

    Thanks,
    venkat
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    In Slice, you must use "::" as scope operator, not ".". If the Slice definitions are in separate files, then you must use a #include statement to include the definitions where required.
Sign In or Register to comment.