1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

An interesting C# question

Discussion in 'Software Development' started by shieldguy, Nov 23, 2006.

Thread Status:
Not open for further replies.
  1. shieldguy

    shieldguy Thread Starter

    Joined:
    Jul 14, 2006
    Messages:
    5
    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
     
  2. Jimmy444

    Jimmy444

    Joined:
    Sep 10, 2006
    Messages:
    96
    "childA ( grandChildAA ( greatGrandChildAAA () ) grandChildAB () ) childB ( grandChildBA () ) childC ()&#8221; <------ can You Pls Explain this?
     
  3. wasim safder

    wasim safder

    Joined:
    Nov 16, 2006
    Messages:
    9
    Please give graphical representation if possible so that we understand your question
    better.
    please tell about the "child c,child b's " Parent
    AS EJAZ asked
    Tell what that function do?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/520591

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice