| Thread overview | |||||
|---|---|---|---|---|---|
|
April 20, 2004 pointer to class in class | ||||
|---|---|---|---|---|
| ||||
class Node
{
Node myPointer;
void test()
{
myPointer = new Node;
}
}
this doesnt work, it says its unidentified.
any ideas?
| ||||
April 20, 2004 Re: pointer to class in class | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Fabian | 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/ | |||
April 21, 2004 Re: pointer to class in class | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Fabian | 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/ | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply