<div class="t-tr-text">C + +. Mots-clés:<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ keywords:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> class
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
D'utilisation
- déclaration d'une classe
- Dans un modèle de classe ou modèle de fonction,
classpeut être utilisé comme alternative à typename d'introduire les paramètres de modèle de type .Original:In a modèle de classe or modèle de fonction,classcan be used as an alternative to typename to introduce type template parameters.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Si une fonction ou une variable existe dans la portée avec le nom identique au nom d'un type de classe,
classpeut être ajouté au début du nom pour la désambiguïsation, résultant en une élaboré spécificateur de typeOriginal:If a function or a variable exists in scope with the name identical to the name of a class type,classcan be prepended to the name for disambiguation, resulting in an elaborated type specifierThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exemple
class Foo; // forward declaration of a class
class Bar { // definition of a class
public:
Bar(int i) : m_i(i) {}
private:
int m_i;
};
template <class T> // template argument
void qux() {
T t;
}
int main()
{
Bar Bar(1);
class Bar Bar2(2); // elaborated type
}