I am trying to define interfaces for a library which will be using pimpl-idiom. Following is a typical interface class which I define.

```
struct A {
public:
   void func1();
   void func2();
   virtual void notif1();
   virtual void notif2();
private:
   class AImpl;
   AImpl *impl;
}

```

The functions func1(), func2() are the interface functions. And notif1(), notif2() are the notification functions which the application has to implement (in the subclass of A).

Is this the right way to define an interface for a library?
Are there any disadvantages with this method or is there any better solution?

---

Thanks for all the answers.
So from all the answers I gather that the following is a good way of representing an interface for a library.

```
// Forward declaration
class AImpl;

struct A {
public:
   void func1();
   void func2();
private:
   virtual void notif1();
   virtual void notif2();
   AImpl *impl;
}

```

The interface library will implement the interface functions and application will implement the notification functions in the derived class.
Is there any good example of a library which follows this pattern?