Definitions of interface classes

Alexandros Frantzis alexandros.frantzis at canonical.com
Tue Mar 26 10:00:54 UTC 2013


Hi all,

in the code we use a couple of slightly different ways to define
interface classes.  Although the variations are mostly equivalent
functionally, it would be nice to decide on a standard way and add
it to the coding guide. The variation I see mostly (and use) is:

class Interface
{
public:
    virtual ~Interface() {}

    virtual void method1() = 0;
    virtual void method2() = 0;

protected:
    Interface() = default;
    Interface(Interface const&) = delete;
    Interface& operator=(Interface const&) = delete;
};

There was also some discussion about using:

virtual ~Interface() = default;

because of the noexcept guarantee.

Thoughts?

Thanks,
Alexandros



More information about the Mir-devel mailing list