Re: GObject Singleton
- From: Stefan Kost <ensonic hora-obscura de>
- To: Uzytkownik <uzytkownik22 gazeta pl>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GObject Singleton
- Date: Thu, 08 Sep 2005 08:54:09 +0200
hi,
Uzytkownik wrote:
I have singleton A and subclass B, C and D.
1. How do it in GObject?
The sigleton pattern is usually realized by having a factory method. The
application would use e.g.
gdk_display_manager_get()
which returns a reference to always the same GdkDisplayManager object. Such a
class has no public gdk_display_manager_new() method. The implementation of the
_get() method would use a static variable and create the instance on the first
request to _get().
2. Can I do something that I cannot have B or D at the same time?
Not that I know. A base class has not controll over who subclasses them. What do
you want to achieve. I am not aware of any OO system that could do that and I
miss a cese where this would be needed.
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]