Results 1 to 3 of 3

Thread: Node or NodeI ?

  1. #1
    rc_hz is offline Registered User
    Name: Eric RC
    Organization: www.genband.com
    Project: No project yet
    Join Date
    Jul 2004
    Location
    Hangzhou, China
    Posts
    189

    Node or NodeI ?

    Page 368 in Ice 3.1.0 document:
    Code:
    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. However, if we want to invoke a
      member function of the NodeI class at this point, we must use a NodeI reference:
          NodeI servant = new NodeI("Fred");
      
      Whether you use a Node or a NodeI reference depends purely on whether you
      want to invoke a member function of the NodeI class: 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.jav a:
    Code:
    	File file = new FileI("README", root);                                      
    	String[] text;                                                              
    	text = new String[] { "This file system contains a collection of poetry." };
    	try {                                                                       
    		file.write(text, null);
    	} catch (GenericError e) {                                                  
    		System.err.println(e.reason);                                       
    	}
    Are they inconsistent ?

    Thank you !
    Last edited by rc_hz; 08-20-2006 at 02:01 AM.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    What is meant here are member functions of NodeI that are not defined in the Slice definition of Node.

  3. #3
    rc_hz is offline Registered User
    Name: Eric RC
    Organization: www.genband.com
    Project: No project yet
    Join Date
    Jul 2004
    Location
    Hangzhou, China
    Posts
    189
    Quote Originally Posted by marc
    What is meant here are member functions of NodeI that are not defined in the Slice definition of Node.
    Thanks. So it is just a problem of inheritance. I think this paragraph is a little misleading.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding/Removing Node
    By jeevaraj in forum Help Center
    Replies: 3
    Last Post: 09-28-2010, 11:52 AM
  2. Discovery of adapter on new node
    By jeevaraj in forum Help Center
    Replies: 1
    Last Post: 07-30-2010, 01:40 PM
  3. node is down
    By zeronumber in forum Help Center
    Replies: 3
    Last Post: 12-17-2009, 03:23 AM
  4. how to shut down a node?
    By russule in forum Help Center
    Replies: 2
    Last Post: 01-08-2007, 04:13 AM
  5. IcePack node monitoring
    By brian in forum Help Center
    Replies: 9
    Last Post: 10-08-2003, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •