fork download
  1. #include <string>
  2. using namespace std;
  3.  
  4. class Teste2 {
  5. int x;
  6. int y;
  7. public:
  8. Teste2(int x, int y) {}
  9. };
  10. class Testando {
  11. Teste2 *teste2;
  12. public:
  13. Testando(Teste2 *teste2) {}
  14. };
  15. class Teste : public Testando {
  16. string nome;
  17. int numero;
  18. public:
  19. //Supondo que Teste2 teste2 foi instanciado na Classe Testando
  20. Teste(Teste2 *teste2, string nome, int numero) : Testando(teste2) {
  21. this->nome = nome;
  22. this->numero = numero;
  23. }
  24. };
  25. int main() {
  26. auto teste = Teste(new Teste2(1, 2), "joão", 1);
  27. }
  28.  
  29. //https://pt.stackoverflow.com/q/120253/101
Success #stdin #stdout 0s 4480KB
stdin
Standard input is empty
stdout
Standard output is empty