Re: [Vala] Warnings when subclassing classes without public constructor



(missed the mailing-list)

2009/12/21 Mike Massonnet <mmassonnet gmail com>:
2009/12/21 Abderrahim Kitouni <a kitouni gmail com>:
Hi,

2009/12/20 Mike Massonnet <mmassonnet gmail com>:
Hello,

I had like to know if there exists a way to avoid a warning when
compiling with valac classes that subclass classes without public
constructors. As an example, Gtk.Bin doesn't have any public
constructor but it is still valid to subclass it. The warning printed
is the following:

 warning: unable to chain up to private base constructor
Chain up to a class that has a public, non [CCode
(has_construct_function=false)] constructor.

Please note that in Vala, you don't need to chain up to direct base
class, you may for example chain up directly to Object (this is the
preferred way to set construct properties).

something like this should solve your problem :
public MyClass() {
Object();
}

This does remove the warning, thanks.

HTH,
Abderrahim

Kind Regards
--
Mike




-- 
Mike



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]