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
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