View Code? Open in Web Editor
NEW
The goal of these modules is to introduce us to bject-Oriented Programming.This will be the starting point of our C++ journey.
Home Page: https://www.linkedin.com/in/achrafelkhnissi/
Makefile 15.99%
C++ 84.01%
cpp_modules's Issues
Hey! I was checking your answers and noticed that you are using stoi, stof and stood in module 06. As explained here , those are C++11 functions.
Did you get an exception from your School or is there a loophole in the rules?
bool Converter::isImpossible ( void ) {
try
{
if ( _type == INT ) {
_n = std::stoi ( _str );
} else if ( _type == FLOAT ) {
_f = std::stof ( _str );
} else if ( _type == DOUBLE ) {
_d = std::stod ( _str );
}
}
catch ( std::exception & e )
{
_impossible = true ;
return true ;
}
return false ;
}
You forgot to delete the currrent Brain before copying it on the defintion of the copy assignment operator of cats and dogs, so when you make a copy of, let's say, a dog, using the '=' operator, you got leaks because there is a never deleted Brain.