25.07.2017 Views

Intro-CSharp-Book-v2015

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

700 Въведение в програмирането със C#<br />

}<br />

set<br />

{<br />

this.value = value;<br />

}<br />

/// <br />

/// The left child of the node<br />

/// <br />

public BinaryTreeNode LeftChild<br />

{<br />

get<br />

{<br />

return this.leftChild;<br />

}<br />

set<br />

{<br />

if (value == null)<br />

{<br />

return;<br />

}<br />

if (value.hasParent)<br />

{<br />

throw new ArgumentException(<br />

"The node already has a parent!");<br />

}<br />

}<br />

}<br />

value.hasParent = true;<br />

this.leftChild = value;<br />

/// <br />

/// The right child of the node<br />

/// <br />

public BinaryTreeNode RightChild<br />

{<br />

get<br />

{<br />

return this.rightChild;<br />

}<br />

set<br />

{<br />

if (value == null)<br />

{<br />

return;<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!