Page 1 of 1

How do I override protected members?

PostPosted: Sun Dec 07, 2008 11:17 am
by gauthier
How do you declare protected override members?
class Base
get a as String is protected
return "a"

class Inherited
inherits Base
get a as String is override
return "b"


gives
Code: Select all
error: "Sub.A": cannot change access modifiers when overriding "protected" inherited member "Base.A"
warning: (Location of symbol related to previous error)
Compilation failed - 1 error, 1 warning


class Base
get a as String is protected
return "a"

class Inherited
inherits Base
get a as String is protected override
return "b"


gives

Code: Select all
error: Expecting EOL, but got "override" instead.
Compilation failed - 1 error, 0 warnings


Thanks for your help

Re: How do I override protected members?

PostPosted: Sun Dec 07, 2008 12:48 pm
by Charles
Put commas in between like it's a list.
...is protected, override

Re: How do I override protected members?

PostPosted: Sun Dec 07, 2008 1:09 pm
by gauthier
Thank you, I just added a page on the wiki if of any use:

http://cobra-language.com/trac/cobra/wi ... erModifier

Re: How do I override protected members?

PostPosted: Sun Dec 07, 2008 1:11 pm
by Charles
Thanks. I also added a ticket so that in the future, the Cobra compiler will tell you.

http://cobra-language.com/trac/cobra/ticket/87

Re: How do I override protected members?

PostPosted: Sun Dec 07, 2008 1:37 pm
by gauthier
Thanks, indicative error messages are a major feature for the compiler, and cobra is already quite helpfull at this :)