Tech Support Guy banner
Status
Not open for further replies.

An interesting C# question

1K views 2 replies 3 participants last post by  wasim safder 
#1 ·
Hi I am learning ASP.Net C# programming, My friend give me a very interesting question to solve

I have the following class decleration for a person, I need to write a C# code, for the following functions: PrintDescendants() and TestPrintDescendants()

PrintDescendants should return a string in the following format:

“childA ( grandChildAA ( greatGrandChildAAA () ) grandChildAB () ) childB ( grandChildBA () ) childC ()”

public class Person
{
List<Person> children;
string name;

public Person(string name)
{
this.name = name;
}

public string PrintName()
{
return name;
}

// print all of your descendants (children, grandchildren, etc)
// into a string
public string PrintDescendants()
{

}
}

[TestFixture]
class TestPerson
{
[Test]
public void TestPrintDescendants()
{
}
}

I will be very thankfull If any one can give me a hint what is actually I needed to do and how to solve the problem.

Thankyou
 
See less See more
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top