Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
An abstract class is a
type of class that can not be
instanciated itself: only its
derivatived classes can.
An Abstract base class is an abstract class
that is also a base class.
An Abstract can be recognized by a
member function starting with the keyword
virtual and ending with =0;. And because all base classes
must have a virtual destructor,
an abstract class must also have one.
Many Design Patterns rely on abstract classes, for example the Strategy.
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[3] Use abstract classes to focus design on the provision of clean interfaces'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 17.7. Advice. page 525: '[4] If a class has a virtual function, it needs a virtual destructor'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[8] A class with a virtual function should have a virtual destructor'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[9] An abstract class typically doesn't need a constructor'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 21.4. Advice. page 640: '[2] Avoid data members in base classes intended as interfaces'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 21.4. Advice. page 640: '[4] Give an abstract class a virtual destructor to ensure proper cleanup'
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
