June 25, 2024, 05:51:12 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


LinkedList class by LarryMc

Started by RitchieF, February 04, 2016, 08:25:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RitchieF

Hi Larry,
using the sample code shown in the LinkList help file for the AddAfter command
with commenting out the two samples at the beginning I get the following message:

Compiling...
LinkedListLarry2.iwb
File: L:\IWBDev3\projects\LinkedList\LinkedListLarry2.iwb (31) Error: Variable m_pCurData should be an UDT or Class
File: C:\Program Files (x86)\IWBDev3\include\LList.inc (9) Warning: See declaration of LList
File: L:\IWBDev3\projects\LinkedList\LinkedListLarry2.iwb (33) Error: MyList is not a member of LList
File: C:\Program Files (x86)\IWBDev3\include\LList.inc (9) Warning: See declaration of LList
File: L:\IWBDev3\projects\LinkedList\LinkedListLarry2.iwb (36) Error: MyList is not a member of LList
File: C:\Program Files (x86)\IWBDev3\include\LList.inc (9) Warning: See declaration of LList
File: L:\IWBDev3\projects\LinkedList\LinkedListLarry2.iwb (27) Warning: Unreferenced variable 'record'
Error(s) in compiling "L:\IWBDev3\projects\LinkedList\LinkedListLarry2.iwb"
Build Failed

How to correct this ?
Thanks

Richard



$use "LList.lib"
$include "LList.inc"

openconsole
Def MyList as LList
MyList.Create()

'=============then===============
'If MyList.AddAfter(NEW(INT,1))=0
'   MyList.#<INT>m_pCurData = 99
'   print MyList.#<INT>m_pCurData
'else
'   print MyList.ErrMsg()
'endif
'=============or===============
'If MyList.AddAfter(NEW(STRING,1))=0
'   MyList.#<STRING>m_pCurData = "Hello"
'   print MyList.#<STRING>m_pCurData
'else
'   print MyList.ErrMsg()
'endif
'=============or===============
TYPE foo
  DEF name as STRING
  DEF age as INT
ENDTYPE
DEF record as foo
If MyList.AddAfter(NEW(foo,1))=0
   MyList.#<foo>m_pCurData.age = 99
   MyList.#<foo>m_pCurData.name = "Grandpa"
   print MyList.#<foo>m_pCurData.age, "  ",   MyList.#<INT>m_pCurData.name
else
   print MyList.ErrMsg()
endif
'=========followed by=============
MyList.ClearAll(TRUE)

print " Any key to end"
do:until inkey$<>""
closeconsole




RitchieF

Got it !!
Typo here :

DEF record as foo
If MyList.AddAfter(NEW(foo,1))=0
   MyList.#<foo>m_pCurData.age = 99
   MyList.#<foo>m_pCurData.name = "Grandpa"
   print MyList.#<foo>m_pCurData.age, "  ",   MyList.#<INT>m_pCurData.name

Must be foo,too.

MyList.#<foo>m_pCurData.name

Richard