Re: template parameters cannot be friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Naje,

>i do not need put method draw in Window's children.

- - - - - - - - - - - - - - - - - - - - -
#include <iostream>

using namespace std;

class Window
{
public:
    void Draw() const
    {
        cout << "Window::Draw" << endl;
    }
};

class BoxWindow : private Window
{
public:
    using Window::Draw;
};

template <typename T>
void Draw(T const& object)
{
    object.Draw();
}

int main()
{
    BoxWindow box;
    Draw(box);
}
- - - - - - - - - - - - - - - - - - - - -

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux