#352 – You Can’t Instantiate an Abstract Class

An abstract class, defined with the abstract keyword, is one that is not meant to be instantiated itself, but serve as a base class for other classes.  A class must be abstract if it contains any abstract methods.

Since an abstract method does not contain an implementation, it doesn’t make sense to instantiate the class containing the abstract method.

You can, however, have non-abstract methods in an abstract class.  Derived classes will inherit the implementation of these methods and could then make use of them.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: