[Qt-interest] = 0 ?
Stephen Collyer
scollyer at netspinner.co.uk
Tue Feb 23 13:34:11 CET 2010
On 23 February 2010 12:26, Lucas Pereira Caixeta <lpcnew at gmail.com> wrote:
>
> Hi all,
>
> In my interface i have this method: virtual String getName () = 0;
>
> why this method have "=0" in the end?
> so that it serves?
>
> This has nothing to do with Qt. It's a C++ feature. When you declare
a method with = 0, you are creating a class that can't be instantiated.
This is called a pure virtual method.
You can only use this class as as a base of another class, and you must
provide a definition of the pure virtual method to be able to instantiate
the
class.
The reason this is useful is that it allows a designer to create a class
which
specifies the interface of a class, but which doesn't provide all the
functionaltity itself.
--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100223/1d6fa8bc/attachment.html
More information about the Qt-interest-old
mailing list