www.digitalmars.com         C & C++   DMDScript  

D - pointer to class in class

reply Fabian <Fabian_member pathlink.com> writes:
class Node
{
Node myPointer;

void test()
{
myPointer = new Node;
}
}

this doesnt work, it says its unidentified.
any ideas?
Apr 20 2004
next sibling parent J Anderson <REMOVEanderson badmama.com.au> writes:
Fabian wrote:

class Node
{
Node myPointer;

void test()
{
myPointer = new Node;
}
}

this doesnt work, it says its unidentified.
any ideas?
You need an entry point (main) void main() { //Code starts here } -- -Anderson: http://badmama.com.au/~anderson/
Apr 20 2004
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
Fabian wrote:
 class Node
 {
 Node myPointer;
 
 void test()
 {
 myPointer = new Node;
 }
 }
 
 this doesnt work, it says its unidentified.
 any ideas?
This might work a little better: class Node { Node myPointer; void test() { myPointer = new Node; } } void main() { Node n = new Node(); n.test(); } -- Justin http://jcc_7.tripod.com/d/
Apr 20 2004