Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Nicholas Wallen12,278 Points
Explain Like I Am Five: Why is AddDays() an instance method but DateTime() is static?
This is extra confusing to me. Can someone explain this in the simplest of terms? Not jargon?
Steven Parker224,848 Points
Instance methods only work on an instance.
So it makes sense that AddDays would be an instance method because you need an instance to add the days to. You can expect instance methods to either get something from, or do something to, the instance that they are applied to.
On the other hand, all constructors (like DateTime) have to be static because you use them to create an instance, and therefore you don't already have one that you could apply them to.
Does that help make it clear?