+ Start a Discussion

Wrapper Class for a nested query

I have a query which nests the related tasks with a contract.  E.g. [Select Id, name , (select Id , subject from tasks ) from contracts].

i know how to create a wrapper class for a query that is not nested but how do I create the constructor class for a query above?

e.g. I would normally have something like

public class wrapper 
public contract con {get;set}
public boolean selected {get;set}
public wrapper (contract c)

i cant seem to use this as the query also includes tasks?

any ideas? Thanks 
This seems to talk about showing the child records on a page. I'm having trouble creating the constructor.

if the query was just on contract the constructor would be as above and I would pass in a contract object - public wrapper(contract c). Since I'm passing a query with children it's not accepting the contract object in this wrapper statement for variable c. What should the object type be?