Consistency with abstraction functions

  abstraction, c++, stack

I have the following function that I use multiple times in my class for abstraction:

void Interpreter::pushToStack(int value)
{
    stack.push_back(std::to_string(value));
}

Now I have a certain function where I do this:

stack.push_back(stack.back());

Is this bad practice? Is it bad to not be consistent in using abstraction functions? Because I think I can’t really use pushToStack(int) since it requires an integer and I want to push stack.back().

Thanks!

Source: Windows Questions C++

LEAVE A COMMENT