Advertisement
Danol

Untitled

Mar 30th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.32 KB | None | 0 0
  1. class Node {
  2.     Node *left, Node *right;
  3.     Void #ctor( Int depth ) { // constructor
  4.         if( depth > 0 ) {
  5.             left = new Node( depth - 1 );
  6.             right = new Node( depth - 1 );
  7.         }
  8.     }
  9. }
  10.  
  11. @ctime Node *a = new Node( 5 );
  12. Node *b = new Node( 2 );
  13.  
  14. Void main() {
  15.     const( Node ) *ptr = userInput ? a : b;
  16.     printTree( ptr );
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement