Archived
This forum has been archived. Please start a new discussion on GitHub.
Node or NodeI ?
Page 368 in Ice 3.1.0 document:
That is, the document emphasizes that if we want to invoke a member function of the XXXI class, we must use a XXXI reference instead of XXX interface reference. Can you explain a little more why ?
Further, in %ICEJ_HOME%\demo\book\simple_filesystem\Server.java:
Are they inconsistent ?
Thank you !
12.8.1Instantiating a Servant Instantiating a servant means to allocate an instance: Node servant = new NodeI("Fred"); This code creates a new NodeI instance and assigns its address to a reference of type Node. This works because NodeI is derived from Node, so a Node reference can refer to an instance of type NodeI. [color="Red"]However, if we want to invoke a member function of the NodeI class at this point, we must use a NodeI reference[/color]: NodeI servant = new NodeI("Fred"); Whether you use a Node or a NodeI reference [color="red"]depends purely on whether you want to invoke a member function of the NodeI class[/color]: if not, a Node reference works just as well as a NodeI reference.
That is, the document emphasizes that if we want to invoke a member function of the XXXI class, we must use a XXXI reference instead of XXX interface reference. Can you explain a little more why ?
Further, in %ICEJ_HOME%\demo\book\simple_filesystem\Server.java:
[b]File file[/b] = new FileI("README", root); String[] text; text = new String[] { "This file system contains a collection of poetry." }; try { [b]file.write(text, null);[/b] } catch (GenericError e) { System.err.println(e.reason); }
Are they inconsistent ?
Thank you !
0
Comments
-
What is meant here are member functions of NodeI that are not defined in the Slice definition of Node.0