Re: Conceptual Question on Signal Handling in Subclasses
- From: Havoc Pennington <hp redhat com>
- To: Ian Flanigan <flan lean to>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Conceptual Question on Signal Handling in Subclasses
- Date: 03 Jun 2001 12:12:49 -0400
Ian Flanigan <flan lean to> writes:
The big question, I suppose, is how to make objects that can talk to
each other in a way that allows subclasses to handle things
differently from the base class. In C++ you'd use virtual functions,
for example.
The reason I'm asking is because I'm trying to implement a
Model-View-Controller scheme in my program where the view can be
changed to one of many different implementations on the fly. Because
I am very much connecting objects together (instead of connecting
objects to some functional framework), I really need to use something
akin to virtual functions since I'm never sure what the underlying
object will actually be.
I would suggest using virtual functions. You can do this in several
ways:
- just use that C++ feature and build with a C++ compiler
- just have a variable in your struct:
void (* do_whatever) (blah blah);
- use the GtkObject system and derive GtkObjects
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]