public class TimeFrames { private object currentTimeFrame; private PerDayTimeFrame perDayTF; private PerWeekTimeFrame perWeekTF; public TimeFrames() { this.perDayTF = new PerDayTimeFrame(); this.perWeekTF = new PerWeekTimeFrame(); } public void setTimeFrame( string currentTF ) { switch(currentTF) { case "perDayTF": this.currentTimeFrame = (PerDayTimeFrame)this.perDayTF; break; case "perWeekTF": this.currentTimeFrame = (PerWeekTimeFrame)this.perWeekTF; break; } } public void tellCurrentTimeFrameToDoSomething() { this.currentTimeFrame.doSomething(); //ERROR! can't find method. } }