Announcement

Collapse
No announcement yet.

Private Methods and Properties

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Private Methods and Properties

    I am converting a class I created in Visual Basic which includes private methods and properties (used only by other methods and properties in the class). How do I implement this with PowerBasic 5/9? Do I use a HIDDEN interface for these elements? I notice that an INTERFACE can be defined AS HIDDEN, but there is no documentation that explains what this does or how it works. There is also no PRIVATE or EXPORT attribute that can be added to a method or property, so I have no idea where else to look. Any ideas?

    TIA,
    Anthony W. J. Giambalvo
    Giami Network Services, LLC
    North Plainfield, NJ USA
    Email: anthony dot powerbasic at giami dot com


  • #2
    Originally posted by Anthony Giambalvo View Post
    I am converting a class I created in Visual Basic which includes private methods and properties (used only by other methods and properties in the class). How do I implement this with PowerBasic 5/9? Do I use a HIDDEN interface for these elements? I notice that an INTERFACE can be defined AS HIDDEN, but there is no documentation that explains what this does or how it works. There is also no PRIVATE or EXPORT attribute that can be added to a method or property, so I have no idea where else to look. Any ideas?

    TIA,
    Depends on how you are using it. If a server then use hidden. If not why do you need private?

    James

    Comment


    • #3
      Originally posted by jcfuller View Post
      Depends on how you are using it. If a server then use hidden. If not why do you need private?
      James,
      The methods are used by most public methods and properties to manipulate class variables at a low level, and can be dangerous if called directly by a malicious or careless programmer. They are there to make programming the class easier, and not intended for class users to call.
      Anthony W. J. Giambalvo
      Giami Network Services, LLC
      North Plainfield, NJ USA
      Email: anthony dot powerbasic at giami dot com

      Comment


      • #4
        CLASS METHODS??

        James

        Comment


        • #5
          Originally posted by jcfuller View Post
          CLASS METHODS??
          Interface methods. The only class methods I use are Create and Destroy. Would class methods be used to do what I want? My only point of reference with classes is VB6, which doesn't provide for multiple interface definitions within a class, but does provide Private and Public methods.
          Anthony W. J. Giambalvo
          Giami Network Services, LLC
          North Plainfield, NJ USA
          Email: anthony dot powerbasic at giami dot com

          Comment


          • #6
            > Would class methods be used to do what I want?

            Yes.

            Anthony, James has answered your question.

            GoTo Programming Reference > Objects and Com Programming > What is a Class Method? Here

            Create and Destroy are special class methods.

            Comment


            • #7
              Originally posted by David Roberts View Post
              >
              Yes.
              Yes, David. Thank you. I did read that before I actually received the compiler, but my memory is not what it used to be .

              The question still remains, though. What is AS HIDDEN used for in the interface definition, then? It is shown in the INTERFACE block definition, but never mentioned in the documentation (that I can see, at least). None of the example code I've seen uses it.
              Anthony W. J. Giambalvo
              Giami Network Services, LLC
              North Plainfield, NJ USA
              Email: anthony dot powerbasic at giami dot com

              Comment


              • #8
                It is to do with the hResult. Do a search for 'hidden'.

                Comment


                • #9
                  "AS HIDDEN" interfaces are not included in the TLB, so no-one else will know about that particular interface if you publish the ActiveX DLL. Simple as that
                  kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                  Comment


                  • #10
                    Aha. Thanks, Kev. A better search is "as hidden" but all the "hidden" refs still get thrown up but the "as hidden" get highlighted as well.

                    Comment


                    • #11
                      Thanks Kev and David. I searched for AS HIDDEN, but did not see that information. I will spend more time tonight rereading the documentation. Seems like a good night for some light reading.
                      Anthony W. J. Giambalvo
                      Giami Network Services, LLC
                      North Plainfield, NJ USA
                      Email: anthony dot powerbasic at giami dot com

                      Comment

                      Working...
                      X