Am 24.08.2013 um 09:46 schrieb Constantin Makshin <cmaks...@gmail.com>:

> Overriding a public method to make it private doesn't make much sense because 
> this restriction can be easily circumvented by casting the pointer/reference 
> to a base class (explicitly or by passing it to a function, in the context of 
> this thread, expects a QFile or even more generic QIODevice).
> 
Casting? Pointers? Why so complicated?

C++ makes this easy for you:

#define private public
#include "Foo.h"

There you go: all private members of class Foo have just become public! A hip 
hip horray for the preprocessor ;)

Oh, by the way: should you feel the urge to pass on this "tip" to someone else: 
please don't mention my name, will you? ;)


But on a more serious note: overriding a public method and make it private is 
more like a "design decision" and a strong hint to the caller not to call this 
member on that concrete class instance anymore: why not? Go read the docs! (And 
if you still feel like calling it: C++ offers you plenty of choices ;))

Cheers,
  Oliver


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to