This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: template parameters cannot be friends


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]