Re: [Vala] Invalid cast Warnings
- From: Daniel Brendle <grindhold skarphed org>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Invalid cast Warnings
- Date: Sun, 5 Feb 2017 18:49:42 +0100
On 02/05/2017 06:43 PM, Luca Dionisi wrote:
Obviously you can't cast an instance of a base class to a superclass.
You can do:
var a = new TestSubType();
TestBase b = (TestBase)a;
Not viceversa.
What do you suggest as a pattern then for this scenario?
I want to extend the functionality of the library classes. Therefore I
should inherit from them. As it seems to me this is a valid OOP-style
endeavour.
But the library will only yield the objects it knows. I will never get
it to yield my subclassed objects. What mechanism do you suggest to use
to achieve this?
Thanks, Grindhold
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]