std::is_abstract – cppreference.com
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>
| definiert in Header <type_traits> |
||
|
|
(seit C++11) | |
Wenn T eine abstrakte Klasse (das heißt, eine Klasse, oder erklärt, erbt mindestens eine rein virtuelle Funktion) ist, stellt das Mitglied konstanten value gleich true. Für jede andere Art, value ist false .
Original:
If T is an abstract class (that is, a class that declares or inherits at least one pure virtual function), provides the member constant value equal true. For any other type, value is false.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inherited from std::integral_constant
Member constants
Original:
The text has been machine-translated via Google Translate. (public static Mitglied konstanten) | |
Member functions
wandelt das Objekt Original: converts the object to The text has been machine-translated via Google Translate. (öffentliche Elementfunktion) | |
Member types
Type Original: Type The text has been machine-translated via Google Translate. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value>
|
Notes
Abstrakte Klassen können nur als Basisklassen verwendet werden; keine Objekte einer abstrakten Klasse Typ kann außer in Form von Basisklasse Unterobjekte erstellt werden .
Original:
Abstract classes may only be used as base classes; no objects of an abstract class type can be created except in form of base class subobjects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Eine abstrakte Klasse kann von einer Klasse, die nicht abstrakt ist, wenn eine rein virtuelle Funktion überschreibt eine virtuelle Funktion, die nicht rein abgeleitet werden .
Original:
An abstract class may be derived from a class that is not abstract if a pure virtual function overrides a virtual function that is not pure.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Beispiel
#include <iostream> #include <type_traits> struct A { int m; }; struct B { virtual void foo(); }; struct C { virtual void foo() = 0; }; struct D : C {}; int main() { std::cout << std::boolalpha; std::cout << std::is_abstract<A>::value << '\n'; std::cout << std::is_abstract<B>::value << '\n'; std::cout << std::is_abstract<C>::value << '\n'; std::cout << std::is_abstract<D>::value << '\n'; }
Output:
Siehe auch
| checks if a type is a class type (but not union type) (Klassen-Template) [edit] | |
prüft, ob ein Typ ist polymorphe Klasse Typ Original: checks if a type is polymorphic class type The text has been machine-translated via Google Translate. (Klassen-Template) [edit] | |