Re: [Vala] casting out parameters
- From: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
- To: pancake <pancake youterm com>, vala-list gnome org
- Subject: Re: [Vala] casting out parameters
- Date: Wed, 26 May 2010 07:52:06 +0800
On Tue, 2010-05-25 at 11:12 +0200, pancake wrote:
How can I cast an out parameter?
public class Foo {}
public class Bar : Foo {}
void test(out Foo foo) {
foo = new Bar ();
}
void main() {
Bar bar;
test (out bar);
}
a.vala:10.9-10.15: error: Argument 1: Cannot convert from `Foo' to `Bar?'
More verbose error message: test(out Foo foo), considered
as a black box, may assign to foo any descendant of Foo,
not necessarily Bar.
Try:
Foo x;
test (out x);
Bar bar = x as Bar;
hand
Nor Jaidi Tuah
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]