views:

96

answers:

5

What does it mean to "return the client?"

My teacher asked in an assignment to write a method that will return the date and the client. Here is her exact wording:

" You should also override the ToString method, to return the date and the client. (DateTime has a reasonable ToString method defined. Use it.) I found using "\t" (the tab symbol) helpful in lining up columns. "

I'm not sure what she is asking when she says to return the client. I understand how to return the date. Thank you.

+2  A: 

maybe she meant to the client (the caller of the function ?)

if you have other data in your object, maybe she wants you to return it in a certain way (and not the default ToString() behaviour ?

Dani
your first suggestion seems like the most logical explanation.
Cheeso
+6  A: 

Maybe you should ask her.

In the working world you'll want to get as much clarification from your customer on the deliverables as required.

Jay Riggs
That's a great point. Thank you.
Louise
A: 

Might be a typo -- maybe instead of "return the date and the client" she meant "return the date to the client"?

_rusty
+1  A: 

Maybe the client is the object you use ToString on. Like intSomeInteger.ToString

Leon
A: 

My guess is you have a class containing a DateTime and a Client, something like:

class MyClass
{
   public DateTime Date {get; set;}
   public Client MyClient {get; set;}
}

The task would be then to override MyClass.ToString() and probably Client.ToString() to something like:

class Client
{
   public string Name {get; set;}
   public override ToString()
   { 
    return Name;
   }
}

class MyClass
{
   public DateTime Date {get; set;}
   public Client MyClient {get; set;}
   public override ToString()
   { 
    return string.Format("Client: {0}; Date: {1}", MyClient, Date);
   }
}
vladhorby