Is there a general naming convention for private virtual functions in C ++?

Is there a general naming convention for C ++ private virtual functions? I have seen agreements such as do_something(...), something_vfunc(...)etc. What convention is commonly used in C ++ projects?

+5
source share
4 answers

The convention used in the standard (for example, among many std::numpunct) is what do_somethingis a protected virtualmethod, and somethingis a publicnon method virtualthat calls it.

+2
source

i use the prefix dyn_. so you can see:

class t_type {
public:
    /* ... */
    void method() {
        this->dyn_method();
    }

private:
    virtual void dyn_method() const = 0;
};

class t_subtype : public t_type {
public:
    /* ... */
private:
    virtual void dyn_method() const {
        ...
    }
};

as a general - I'm not sure.

+1
source

, . Impl _impl . ComputeFoo ComputeFooImpl .

+1
source

Different teams and people use different standards. My personal thing is not to add any special prefixes or suffixes. The name should represent what this function does. The IDE will help you find out if it is private or secure, virtual or not. And yes, it tastes good to make a virtual function private or secure, but if you add a new function just to follow this principle, think twice.

+1
source

All Articles