Posts: 357
Threads: 118
Joined: Oct 2004
Code:
TYPE two3tree
root as two3node ptr
size as integer
depth as integer
AddNode as Sub(value as integer)
END TYPE
SUB AddNode(value as integer)
If this.root = 0 then
this.root = NewTwo3Node(value)
else
dim p as Two3Node ptr
p = this.root
end if
this.size = this.size + 1
END SUB
NewTwo3Node returns a Two3Node ptr but that like gives me an Implicit conversion warning and p = this.root gives me the suspicious pointer assignement warning. What's going on?
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Posts: 324
Threads: 12
Joined: Nov 2005
Is this a global variable? Looks like it should be a parameter. ie., there is no implicit this, reference or pointer. You'll have to pass the address - or reference - of an 'object' to it's 'member functions' manually.
stylin:
Posts: 1,439
Threads: 15
Joined: Apr 2003
Yeah, function pointers are the same as in C - not member functions of classes. Make sure you use Option Explicit to catch undeclared variables.
Posts: 357
Threads: 118
Joined: Oct 2004
O, I thought
this worked the same was as it did in C++. There is no way to access a subs invoking data type from within the sub?
ie:
Code:
DIM temp as two3tree
temp = NewTwo3Tree
temp.AddNode(6)
There is no way to access temp from inside the AddNode sub without passing having it be a parameter?
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Correct, it must be a parameter. hopefully fb will move rapidly towards a move to a gcc frontend, which will give us oop and lead basic users once and for all into the promised land...
er.. sorry i got carried away there :o