Announcement

Collapse
No announcement yet.

Class/End Class documentation error

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

  • Class/End Class documentation error

    There appears to be an error in the "CLASS/END CLASS BLOCK" help file entry.

    Code:
    CLASS name  [$GUID]  [AS COM | AS EVENT]
      Class Method code blocks...
      INSTANCE ClassName AS STRING
      INTERFACE name $GUID  [AS EVENT]
        INHERIT IUNKNOWN
        Method and Property code blocks...
      END INTERFACE
      EVENT SOURCE interface-name
    END CLASS
    My tests indicate that putting Class Methods before the Instance variables throws a compile time error.
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

  • #2
    Hey Paul

    I can also reproduce this as well
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

    Comment


    • #3
      What would be a problem of that?
      hellobasic

      Comment


      • #4
        Not a problem per se, but when trying to code something based on the documentation wouldnt work. You would need to know before hand that the documentation was wrong to get a good compile
        Sr. Software Development Engineer and Sr. Information Security Analyst,
        CEH, Digital Forensic Examiner

        Comment


        • #5
          Originally posted by Edwin Knoppert View Post
          What would be a problem of that?
          It looks like a documentation error in the PB9 Help file. Probably needs to be corrected.
          Paul Squires
          FireFly Visual Designer (for PowerBASIC Windows 10+)
          Version 3 now available.
          http://www.planetsquires.com

          Comment


          • #6
            I already read about your choice of using dim (Jose's remark on his board today).
            I wonder what the effect is using dim inside a class.
            hellobasic

            Comment


            • #7
              You have to use DIM in a Class when initializing an array. My mistake was not using AS INSTANCE.
              Code:
              Class clsCompany
                 Instance m_pCustomers()   As CustomerInterface
              ...
              ...
              ...
                 Class Method Create()
                    ' Initialize the customer array
                    Dim m_pCustomers(0) As Instance CustomerInterface
                 End Method
              ...
              ...
              ...
              The point of this thread is that you can not put METHODS (CLASS or otherwise) before the INSTANCE variables are defined. The documentation would suggest otherwise.
              Paul Squires
              FireFly Visual Designer (for PowerBASIC Windows 10+)
              Version 3 now available.
              http://www.planetsquires.com

              Comment


              • #8
                Place them at the beginning, and you'll find yourself at peace...

                Comment


                • #9
                  True, I also already have already been falling over this chair.

                  Code:
                   
                  CLASS MDC
                    INSTANCE ApPath,ApName,IniFn,PC_Name AS STRING
                    INSTANCE IP_Adr,Num_Folders,MD_Active AS LONG
                  This is the place for the INSTANCE Variables, any thing else will may work as expected.

                  Comment

                  Working...
                  X