Questions tagged as 'c++'

2
answers

Is it wrong to mix struct with class in C ++?

I have the following class: #ifndef PESSOA_H_INCLUDED #define PESSOA_H_INCLUDED #include <string> struct aniver{ int dia; int mes; int ano; }; class Pessoa{ private: std::string nome; std::string sex...
asked by 17.12.2017 / 06:18
1
answer

How to modify dynamic array?

I'm having trouble modifying a dynamic array already created. The following example depicts my problem. In this example the program compiles but gives execution error (nothing appears and shows the dialog saying that the program stopped working)...
asked by 11.11.2017 / 15:47
1
answer

With reading a keyboard number without using the "enter" in C ++

I want to create a menu where the user chooses the option 1 to 5, would like the user to type the number and the program would enter the option without having to press Enter . Here's an example #include <iostream> #include <cstdio...
asked by 13.11.2017 / 18:04
1
answer

I have a question about inherited default constructors

I'm in doubt as I try to improve an OOP exercise here .. (-) = no I have the PAI class with two constructors (one is default). In the SON class I have two more constructors (no-default). In the definition of one of these constructors there...
asked by 23.12.2017 / 13:49
1
answer

What's the difference between initializing a variable in these constructors? And how to put a constructor as default?

Is there any difference in initializing a variable in any of these forms of constructors? And how do I put a constructor as default ( default ) in a class that has more than one constructor? Builder 1: class Teste { private: int valor1,...
asked by 30.10.2017 / 15:04
2
answers

Is it possible to add extra classes to a dll?

The compiler even compiles perfectly, but for some reason when I run app.exe it returns an error, it follows my code: main.cpp #include <iostream> #include "cpp.h" int main() { ClassA * a = new ClassA(); std::cout <&l...
asked by 28.09.2017 / 22:22
1
answer

Split words with find_if

How is this string (i, j) assembled? the first string inserted in the vector is "Robison" and is correct, but to have this result the value of i should be 0 and j = 7, no? #include <iostream> #include <string> #include <vector&g...
asked by 26.09.2017 / 03:58
2
answers

undefined reference to 'Test_1 :: Test_1

Generally they say that the .cpp is not included in main and yes the .h, however in my case whenever I will include the .h gives error and I do not know why. follow the code: main.cpp #include <iostream> #include "Teste_1.h" int m...
asked by 07.10.2017 / 21:55
1
answer

Is there any difference between "new" and "reinterpret_cast" for a memory buffer?

I would like to know if there is any difference in the final product of these two codes: //------ Declaração curta class ClasseA { public: int valor; Classe() { iniciar(); } ClasseA * iniciar() { valor = 10; return this; } } int...
asked by 06.10.2017 / 18:19
1
answer

Conversion to int with static_cast in c ++

Doing a search found something related to this error. I have the following error below:    ERROR: date.cxx: In member function 'int   CurrentDateTime :: GetMonth (const string &) ': date.cxx: 125: 18: error:   can not convert 'const Month...
asked by 13.09.2017 / 20:09