Martin Vermeer <[EMAIL PROTECTED]> writes:

| On Tue, Nov 01, 2005 at 09:23:05PM +0100, Lars Gullik Bjønnes wrote:
| > Martin Vermeer <[EMAIL PROTECTED]> writes:
| > 
| > | On Tue, Nov 01, 2005 at 06:58:08PM +0100, Jean-Marc Lasgouttes wrote:
| > | > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
| > | > 
| > | > Martin> OK. Should we set all these values to 1000? Might unearth some
| > | > Martin> problems we didn't even know about.
| > | > 
| > | > Why not an abstract virtual function or an assert?
| > | > 
| > | > JMarc
| > | 
| > | Here is the patch using abstract virtual functions. Seems to work, and
| > | is undoubtedly more robust, in spite of being a lot more code.
| > 
| > I am not sure that I like this, especially at this stage in the
| > endgame of 1.4.0cvs.
| > 
| > Shouldn't all insets have dimensions? In that case Dimension should
| > be in the base. (and I'd like to see NVI used for the methods).
| 
| OK. Happy to oblige, once I understand it :-)
| 
| NVI = Nonvirtual Interface Idiom? Could you elaborate with an example?

Not for 1.4 though...

class Base {
public:
        int width() const {
                return priv_width();
        }
private:
        virtual int priv_width() const = 0;
};

class Deriv : public Base {
private:
        virtual int priv_with() const {
                return 42;
        }
};

Is an example of NVI.

-- 
        Lgb

Reply via email to