D - binary tree?
- Fabian (8/8) Apr 20 2004 hrmm can i make a binary tree with D?
- Stewart Gordon (10/20) Apr 20 2004 Have you written a complete program that shows how it doesn't like this
- C. Sauls (19/30) Apr 20 2004 I've used this... for example, some code from a database converter I
- Stephan Wienczny (5/18) Apr 20 2004 What you are trying is _NOT_ possible.
- Russ Lewis (11/32) Apr 20 2004 Huh? I do see a minor syntax error...but the code is basically valid.
hrmm can i make a binary tree with D? seems it doesnt like having a pointer to a class inside a class? eg: Node { Node pointer; } is this possible yet with D?
Apr 20 2004
Fabian wrote:hrmm can i make a binary tree with D? seems it doesnt like having a pointer to a class inside a class? eg: Node { Node pointer; }Have you written a complete program that shows how it doesn't like this yet? Have you tried compiling it yet? Have you come up with an exact error message yet?is this possible yet with D?Yes, as far as I know. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Apr 20 2004
I've used this... for example, some code from a database converter I semi-recently wrote: ------------------------------ // . . . some junk class DBObj { // . . . some junk DBObj parent, children, children_next, location, contents, contents_next; // . . . some junk } ------------------------------ So I must not understand what the problem is... -C. Sauls -Invironz Fabian wrote:hrmm can i make a binary tree with D? seems it doesnt like having a pointer to a class inside a class? eg: Node { Node pointer; } is this possible yet with D?
Apr 20 2004
Fabian wrote:hrmm can i make a binary tree with D? seems it doesnt like having a pointer to a class inside a class? eg: Node { Node pointer; } is this possible yet with D?What you are trying is _NOT_ possible. "Node" should be "class Node" or "struct Node" Then it should work Have a look at my dlinked list at http://d.wienczny.de
Apr 20 2004
Huh? I do see a minor syntax error...but the code is basically valid. You can do this: class Node { Node pointer; // this is a reference to a class object }; or this: struct Node { Node *pointer; }; Russ Stephan Wienczny wrote:Fabian wrote:hrmm can i make a binary tree with D? seems it doesnt like having a pointer to a class inside a class? eg: Node { Node pointer; } is this possible yet with D?What you are trying is _NOT_ possible. "Node" should be "class Node" or "struct Node" Then it should work Have a look at my dlinked list at http://d.wienczny.de
Apr 20 2004