Title: AW: (ROSE) Question Export control of Method

OK: you want to have methods in a (super)class which can be accessed by "normal" classes but can�t by subclasses?

As far as I know, there is no (direct) way. But you can use "delegation" for it:

public interface CommonMethods {
  public int m1(int a);
}

public class CommonMethodsImpl implements CommonMethods {
  public int m1(int a) {
    // Implementation goes here
    return a;
  }
}

public class Super implements CommonMethods {
  // for delegation
  private CommonMethods cm = new CommonMethodsImpl();
 
  // the delegation
  public int m1(int a) {
    return cm.m1(a);
  }
}

public class Sub extends CommonMethods {
  // normal implementation
}



Maybe that�s something for you.


mit freundlichen Gr��en
Jan Mat�rne

RZF NRW
Sachgebiet 314-P Methodenberatung
Internet:       [EMAIL PROTECTED]


    -----Urspr�ngliche Nachricht-----
    Von:    [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
    Gesendet am:    Donnerstag, 3. Januar 2002 14:49
    An:     [EMAIL PROTECTED]
    Cc:     [EMAIL PROTECTED]; [EMAIL PROTECTED]
    Betreff:        Re: (ROSE) Question Export control of Method


    * * * * Sent by Anil Emmadi on behalf of Anil Emmadi

    But If I declare methods as protected still they will be accessible
    in sub class which I don't want





    Cheers

    Anil Emmadi
    System Analyst & Designer
    Ulysses  Simulation Requirements Analysis and Design
    ----------------------------------------------------------------------
    ---------------------------------
    Mail id :[EMAIL PROTECTED]
    Location : Hinckley
    Contact no : 01455 - 893177
    Internal : 33177
    ----------------------------------------------------------------------
    -------------------------------



            [EMAIL PROTECTED]
            03/01/02 12:46
                    
                   
                     To: [EMAIL PROTECTED] @ gateway
                     cc: [EMAIL PROTECTED] @ gateway
                     Subject: Re: (ROSE) Question Export control of Method

    Dear Anil, if you want that a subclass can acess super class member,
    these
    member have to be declared protected.

    Regards,

    Paulo Lima.


    >From: [EMAIL PROTECTED]
    >Reply-To: [EMAIL PROTECTED]
    >To: [EMAIL PROTECTED]
    >Subject: (ROSE) Question Export control of Method
    >Date: Thu, 03 Jan 2002 12:22:15 +0000 (GMT)
    >
    >
    >* * * * Sent by Anil Emmadi on behalf of Anil Emmadi
    >
    >
    >Hi
    >I am defining a subclass and super class .And I want only few methods
    >should be accessible in subclass.
    >If I use private I can achieve this ,but this methods will not be
    >accesible to other classes(Which I don't want).
    >
    >If I use implementaion I have to move this super class and subclass
    >into different packages.
    >
    >Iam designing for Java lanaguage..how to achieve this.
    >
    >
    >
    >
    >Cheers
    >
    >Anil Emmadi
    >System Analyst & Designer
    >Ulysses  Simulation Requirements Analysis and Design
    >---------------------------------------------------------------------
    -
    >---------------------------------
    >Mail id :[EMAIL PROTECTED]
    >Location : Hinckley
    >Contact no : 01455 - 893177
    >Internal : 33177
    >---------------------------------------------------------------------
    -
    >-------------------------------
    >
    >_____________________________________________________________________
    _
    >
    >The views expressed in this email are not necessarily the views of
    >Transco plc, and the company, its directors, officers or employees
    >make no representation or accept any liability for its accuracy or
    >completeness unless expressly stated to the contrary.
    >
    >This e-mail, and any attachments are strictly confidential and
    >intended for the addressee(s) only. The content may also contain
    >legal, professional or other privileged information. If you are not
    >the intended recipient, could you please notify the sender
    >immediately and then delete the e-mail and any attachments, you
    >should not disclose, copy or take any action in reliance of this
    >transmission.  Unless expressly stated to the contrary, no contracts
    >may be concluded on behalf of Transco plc by means of e-mail
    >communication.
    >
    >You may report the matter by calling us on  +44 (0)1455 230999.
    >
    >You should not copy, forward or otherwise disclose the contents of
    >this e-mail or any of its attachments without express consent.
    >
    >Please ensure you have adequate virus protection before you open or
    >detach any documents from this transmission.  Transco plc does not
    >accept any liability for viruses.
    >
    >Transco plc is part of Lattice Group
    >Transco plc is registered in England: Company number: 2006000
    >Registered Office: 130 Jermyn Street, London, SW1Y 4UR
    >http://www.transco.uk.com
    >*********************************************************************
    ***
    >* Rose Forum is a public venue for ideas and discussions.
    >* For technical support, visit http://www.rational.com/support
    >*
    >* Post or Reply to: [EMAIL PROTECTED]
    >* Subscription Requests: [EMAIL PROTECTED]
    >* Archive of messages:
    >*    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
    >* Other Requests: [EMAIL PROTECTED]
    >*
    >* To unsubscribe from the list, please send email
    >*    To: [EMAIL PROTECTED]
    >*    Subject: <BLANK>
    >*    Body: unsubscribe rose_forum
    >*********************************************************************
    ****
    >




    _________________________________________________________________
    Get your FREE download of MSN Explorer at
    http://explorer.msn.com/intl.asp.




    ______________________________________________________________________

    The views expressed in this email are not necessarily the views of
    Transco plc, and the company, its directors, officers or employees
    make no representation or accept any liability for its accuracy or
    completeness unless expressly stated to the contrary.

    This e-mail, and any attachments are strictly confidential and
    intended for the addressee(s) only. The content may also contain
    legal, professional or other privileged information. If you are not
    the intended recipient, could you please notify the sender
    immediately and then delete the e-mail and any attachments, you
    should not disclose, copy or take any action in reliance of this
    transmission.  Unless expressly stated to the contrary, no contracts
    may be concluded on behalf of Transco plc by means of e-mail
    communication.

    You may report the matter by calling us on  +44 (0)1455 230999.

    You should not copy, forward or otherwise disclose the contents of
    this e-mail or any of its attachments without express consent.

    Please ensure you have adequate virus protection before you open or
    detach any documents from this transmission.  Transco plc does not
    accept any liability for viruses.

    Transco plc is part of Lattice Group
    Transco plc is registered in England: Company number: 2006000
    Registered Office: 130 Jermyn Street, London, SW1Y 4UR
    http://www.transco.uk.com
    ************************************************************************
    * Rose Forum is a public venue for ideas and discussions.
    * For technical support, visit http://www.rational.com/support
    *
    * Post or Reply to: [EMAIL PROTECTED]
    * Subscription Requests: [EMAIL PROTECTED]
    * Archive of messages:
    *    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
    * Other Requests: [EMAIL PROTECTED]
    *
    * To unsubscribe from the list, please send email
    *    To: [EMAIL PROTECTED]
    *    Subject: <BLANK>
    *    Body: unsubscribe rose_forum
    *************************************************************************

Reply via email to