Re: [Vala] Warning while casting custom classes
- From: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
- To: <vala-list gnome org>
- Subject: Re: [Vala] Warning while casting custom classes
- Date: Mon, 23 Jul 2012 08:02:19 +0800
When casting to PicassoLine or PicassoRectangle it pop up:
(Picasso:10091): GLib-GObject-WARNING **: invalid cast from
`PicassoPicassoItem' to `PicassoPicassoRectangle' (or PicassoPicassoLine)
Try changing
((PicassoLine) canvas.preview).....
to
(canvas.preview as PicassoLine)....
If that still gives you warnings, try declaring
PicassoItem class as *abstract* so that you don't
accidentally do something like this:
var type = ItemType.NONE;
PicassoItem item = new PicassoItem(0, 0, type); // big mistake!
item.type = ItemType.CIRCLE; // big mistake!
By the way, I'm sure you don't need ItemType.
Vala supports runtime class check.
hand
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]