The C++Course provides a general introduction to programming in C++. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details. |
Home Trees Defining an Abstract Class | ||
Defining an Abstract Class
public void visit (); } That's it! The word interface is C++'s keyword for an abstract class. The definition of visit looks like any other method definition, except that it has no body. This definition specifies that any class that implements Visitable has to have a method named visit that takes no parameters and that returns void. Like other class definitions, abstract class definitions go in a file with the same name as the class (in this case Visitable.cpp).
|
||
Home Trees Defining an Abstract Class |