Palavras-chave do C++: class
Da 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. |
[editar] Uso
- declaração de uma classe
- Numa modelo de classe ou modelo de função, class pode ser usado como uma alternativa para typename introduzir parâmetros de modelo de tipo.Original:In a modelo de classe or modelo de função, class can 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. - Se uma função ou uma variável existe no escopo com o nome idêntico ao nome de um tipo de classe,
class
pode ser prefixado ao nome para a desambiguação, resultando em um elaborado especificador de tipoOriginal:If a function or a variable exists in scope with the name identical to the name of a class type,class
can 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.
[editar] Exemplo
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 }