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! While you're at it, check out some resources Treehouse students have shared here.

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

C# Intermediate C# Abstraction Abstract Classes

Daniel Hildreth
Daniel Hildreth
16,170 Points

Why exactly do we use the abstract keyword?

Is the abstract keyword literally to implement a class that we want as a basic blueprint for another class? Or is there also another purpose to have abstract classes?

2 Answers

Hendrik Heim
Hendrik Heim
1,012 Points

The abstract modifier indicates that the thing being modified has a missing or incomplete implementation. The abstract modifier can be used with classes, methods, properties, indexers, and events. Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class.

Source: MSDN

Daniel Hildreth
Daniel Hildreth
16,170 Points

That makes sense. Thanks.

Ole Vølund Skov Mortensen
Ole Vølund Skov Mortensen
27,842 Points

"Members marked as abstract, or included in an abstract class, must be implemented by classes..."

.... Wait, so how does abstract classes differ from Interfaces? I'm a little confused.

Very helpful! Abstract just keeps us organized.