Answer the question
In order to leave comments, you need to log in
Is there a quick way to define methods in .cpp files?
Hello.
Maybe I missed something, but the process of writing code in C ++ is somewhat delayed when you first declare the methods in the .h/hpp file, then copy-paste it to the .cpp file, if the body of the method is 2-3 lines, sometimes this process takes longer than coding the method body itself.
Maybe I'm just not aware of how this can be automated?)
Example, you declare a class method in a .h-file:
//source.h
...
class Test
{
void someFunc(float x = 0.f, float y = 0.f);
};
//source.cpp
#include "source.h"
...
void Test::someFunc(float x, float y)
{
}
Answer the question
In order to leave comments, you need to log in
Well, it depends on the IDE and the tools for it. QtCreator does this out of the box. It even monitors method signatures and suggests fixing them when something has changed. VS 2015 can also do something like this, but I'm not sure, I haven't written in it for a long time on the pluses.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question