LB Booster
« OOP test in LBB 3.00 »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:08am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: OOP test in LBB 3.00  (Read 530 times)
bluatigro
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 111
xx OOP test in LBB 3.00
« Thread started on: Jun 26th, 2015, 11:53am »

i tryed something

error :
- it isnt working as expexted

main : Code:
''bluatigro 26 jun 2015
''OOP test

'include _complex.bas

new q as complex 1 , 2

print q::get.r() , q::get.i()

print q::toString$()

input a$
 

_complex.bas : Code:
''bluatigro 27 jun 2015
''OOP lib : complex number

class complex

  dim mr , mi

  sub complex
    mr = 0
    mi = 0
  end sub
  sub complex a , b   
    mr = a
    mi = b
  end sub
  sub fill a , b   
    mr = a
    mi = b
  end sub

  function get.r()
    get.r = mr
  end function 

  function get.i()
    get.i = mi
  end function

  function toString$()
    toString$ = "( " + str$( this::get.r() ) _
    +  " + " + str$( this::get.i() ) + "j )"
  end function

end class  
 
« Last Edit: Jun 26th, 2015, 12:15pm by bluatigro » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: OOP test in LBB 3.00
« Reply #1 on: Jun 26th, 2015, 2:59pm »

on Jun 26th, 2015, 11:53am, bluatigro wrote:
it isnt working as expected

You simply need to move the 'include to the end of the program:

Code:
''bluatigro 26 jun 2015
''OOP test

new q as complex 1 , 2

print q::get.r() , q::get.i()

print q::toString$()

input a$

'include _complex.bas 

Richard.
User IP Logged

bluatigro
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 111
xx Re: OOP test in LBB 3.00
« Reply #2 on: Jul 3rd, 2015, 12:09pm »

@richard :
- i tryed : Code:
''bluatigro 26 jun 2015
''OOP test

new q as complex 1 , 2

print "r = " ; q::get.r() 
print "i = " ; q::get.i()
print q::toString$()

input a$
end

'include _complex.bas )
 


i got a 'mistake' in 'r =' line
i dont know why the ) at the end of the include is for
lbb asked for that
« Last Edit: Jul 3rd, 2015, 12:10pm by bluatigro » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: OOP test in LBB 3.00
« Reply #3 on: Jul 3rd, 2015, 2:45pm »

on Jul 3rd, 2015, 12:09pm, bluatigro wrote:
i dont know why the ) at the end of the include is for

Delete it - that is the cause of your problem. Make sure there is a new-line (CRLF) at the end of the 'include statement; LBB doesn't like the final line of a program to be unterminated.

Richard.

User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls