[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: 0 or 0L for empty pointers?
From: Allan Sandfeld Jensen <kde () carewolf ! com>
Date: 2006-06-23 16:15:11
Message-ID: 200606231815.11587.kde () carewolf ! com
[Download RAW message or body]
On Friday 23 June 2006 17:36, Lubos Lunak wrote:
> Yet another own type system? Yes, you are oldfashioned.
>
It's not another type system. It is just common sense.
Look at KHTML for instance:
Depending on tree, all object either derive from NodeImpl* or RenderObject*,
and in many places you need to know what objects you are dealing with. When
you _need_ a specific type of information you add it to your datatype. In
this way type-information is no different from other types of information.
This way you can have code that does:
if (node->isTextnode())
do the appropiate thing.
Or as a side bonus you can do fast safe casts.
if (node->isTextNode())
static_cast<TextNodeImpl*>(node)->setText("Hello world!");
Again: type-information is no different from any other type of information, if
you need it, you add it your objects.
`Allan
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic