I'm dealing with this problem. I'm creating math problems, each one has response. For example.
- If my question is about the "result of 5x + 15 = 2?", I'll be waiting just one answer (as integer).
- If my question is about says "give me the area and permiter of this shape", I'll be waiting two answers (as doubles).
- In another one, I'll be waiting as response a string
- And anothers, I can have several answers or responses with various datatypes.
My big question is.
How would be the relation between the classes question and response. Also I was dealing if this should be an association, aggregation or composition.
Thanks.
EDIT: Great, it's a composition. Last thing, according to above sentences, how can I represent the design? These are some ideas what I have, but I guess I'm wrong.
public class Question
{
public Response _response;
//public List<Response>
//public Dictionary<string, Response>
public Question()
{
this._response = new Response();
}
}
public class Response
{
}