[bind10-dev] cc message format description and routing daemon added to svn
JINMEI Tatuya / 神明達哉
jinmei at isc.org
Tue Sep 22 23:52:17 UTC 2009
At Tue, 22 Sep 2009 16:32:50 -0500,
Michael Graff <mgraff at isc.org> wrote:
> Over the next day or so, want to sketch out how this thing will work in
> a C++ world. Ruby and Perl and Python should be trivial to implement,
> but C++ is a more strictly typed language, and is causing no end of pain
> to my brain. I'm so used to being able to write:
>
> if foo.class == Array
> ... do something with the array ...
> elsif foo.class == Map
> ... do something with the dictionary ...
> elsif foo.class == String
> ... you get the idea
> end
>
> and I just don't yet know how to do this in C++ without some sort of
> wrapper around each of these, and I want to avoid that.
Couldn't this be a more object-oriented way like this one?
class MessageComponent {
public:
virtual void do_something() = 0;
};
class Array : public MessageComponent {
public:
virtual void do_something();
};
class Map : public MessageComponent {
public:
virtual void do_something();
};
class String : public MessageComponent {
public:
virtual void do_something();
};
and then
MessageComponent* Foo;
Foo->do_something();
Or is it something you'd call a "wrapper" and would avoid?
---
JINMEI, Tatuya
More information about the bind10-dev
mailing list