Advertisement
Guest User

ABNode

a guest
Oct 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DefaultNamespace
  4. {
  5.     public class ABNode<E>     
  6.     {
  7.         private E item;
  8.        
  9.         public virtual E Item          
  10.         {
  11.             get
  12.             {
  13.                 return this.item;
  14.             }
  15.             set
  16.             {
  17.                 this.item = value;
  18.             }
  19.         }
  20.         private ABNode<E> left;
  21.        
  22.         public virtual ABNode<E> Left
  23.         {
  24.             get
  25.             {
  26.                 return this.left;
  27.             }
  28.             set
  29.             {
  30.                 this.left = value;
  31.             }      
  32.         }
  33.         private ABNode<E> right;
  34.        
  35.         public virtual ABNode<E> Right
  36.         {
  37.             get
  38.             {
  39.                 return this.right;
  40.             }
  41.             set
  42.             {
  43.                 this.right = value;
  44.             }
  45.         }
  46.         // constructor
  47.         public ABNode(E item = default(E), ABNode<E> left = null, ABNode<E> right = null)
  48.         {
  49.             this.Item = this.item;
  50.             this.Left = this.left;
  51.             this.Right = this.right;
  52.         }
  53.        
  54.         public virtual void Visit()
  55.         {
  56.             Console.WriteLine("{0} ", this.Item.ToString());
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement