Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: How to bit shift in ThinBasic ?

  1. #11
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170
    Private and Public are working bit different as in .net

    You will use it within type/end type to grant local or global access to the properties or methods of a type but not write it in front of everything but acting as a switch.
    Its like
    Type tExample
    
    'Public '(default setting / not needed here)
    X As Double
    Y As Double
    Z as Double
    
    Private  ' <<< all that follows until "Public" or "End Type" is from now private
    
    A As Long
    B As Long
    
    Function DoSomethingPrivate()
    
    End Function
    
    Public  ' <<< switch to end private scope
    
    Function DoSomethingPublic(ByRef lA As Long, ByRef lB as Long ) 
    ' here accessing Me.A or Me.B is possible
    Me.A= lB - lA
    Me.B = lB + lA
     since keyword "Me" signals a reference of tExample is accessing 
    ' its own data only while 
    
    lA = Me.A
    lB = Me.B
    
    ' were an illegal exploit since that would not obey the rules of privacy 
    ' because its not only giving direct access to the variables but also 
    ' tells theirs position in memory. Would lead to runtime error
    
    end function
    
    end type
    
    Private 
    ' can not be private outside of type declarations
    

    Am not sure if completely developed yet but if your code follows the rules
    it will be compatible
    I think there are missing some Forum-sections as beta-testing and support

  2. #12
    Member
    Join Date
    Aug 2015
    Location
    Keralam, India
    Posts
    121
    Rep Power
    21
    @Rene Miner,
    Am not sure if completely developed yet
    I think that's the reason. Currently, "Private" is making no difference.

  3. #13
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi,

    private / public are reserved keywords, but they have no effect at the moment.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #14
    How to write a property in an UDT ? The "Private" keyword is making no difference in script. Does the UDT section in thinBasic is incomplete ?

  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi gintibande,

    I would say the most complete docs for UDT are currently available here:
    https://thinbasic.github.io/book-thi...defined_types/

    We are working on improving the help file docs to include this information.
    Thanks for understanding.


    P
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Is there a bit-shift function?
    By ISAWHIM in forum thinBasic General
    Replies: 18
    Last Post: 29-09-2008, 17:05
  2. For SHIFT keyword
    By ErosOlmi in forum Samples for help file
    Replies: 0
    Last Post: 26-05-2007, 10:25

Members who have read this thread: 4

Posting Permissions

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