An abstract class contains at least one pure virtual function. You cannot create an object of an abstract class type. A class that contains at least one pure virtual function is considered an abstract class. This example works because the implementation of the static factory method will be creating a derived class. Inspect the actual runtime type of the object returned by the method in the debugger and you will see. It is a userdefined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. You declare a pure virtual function by using a pure specifier 0 in the declaration of a virtual member function in the class declaration. Additionally, we can create an abstract data type adt as a class that has a set of operations. Abstract classes act as expressions of general concepts from which more specific classes can be derived. A pure virtual function is declared by assigning 0 in declaration.
870 504 1091 728 1402 486 1028 889 193 1379 3 866 1038 1100 124 1249 1013 1428 1427 1330 1439 208 231 526 1091 157 289 114 848 1060 924 1478 333 931 776 1052 1518 541 79 842 1346 1430 647 471 1057 455 1390