ZeroC

Archived

This forum has been archived. Please start a new discussion on GitHub.

How to use Slice defined Types in another definition

Venkat Seeth
Venkat Seeth
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

  • marc
    marc Florida
    In Slice code, use Foo::FooClass, just like in C++. In Java code, use Foo.FooClass.
  • Venkat Seeth
    Venkat Seeth
    Marc, thanks for the reply.

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

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

    Venkat
  • Venkat Seeth
    Venkat Seeth
    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
  • marc
    marc Florida
    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.