HomeChallengesRepsProblemsLeaderboardTake a challenge

Print something useful

Console.WriteLine(efua) prints "Child". Make it print the child — with each class formatting only its own part.

Beginner5 min on the clock5 graded checks · 100 pointsDesigning an Object Model
Graded by reading your code against the checklist below.

What you build

  • MonthDay prints 2/29
  • Date prints 2/29/1892, reusing MonthDay’s formatting
  • Child prints Efua born on 2/29/1892
  • Keep every field private

Done means

Three ToString overrides, each formatting its own part, with private fields.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Child prints the child+30Let the object answer
  2. Date reuses MonthDay’s formatting+20Tell, don’t ask
  3. override, not new+20Which method actually runs
  4. Fields remain private+15Objects that protect themselves
  5. No explicit ToString calls+15Let the object answer

What it teaches

The rest of Designing an Object Model