Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
February 20, 2009 "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Hello, When I compile the code below, I've got the following error : OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. private_method_in_interface_file3.obj(private_method_in_interface_file3) Error 42: Symbol Undefined _D33private_method_in_interface_file31I4funcMFiZv --- errorlevel 1 /* ----- CODE ------ */ interface I { int func() ; package void func(int); } class A:I { int i; package void func(int i) { this.i = i; } int func() { return i; } } void main() { I a = new A ; a.func = 10 ; Stdout(a.func).newline ; } /* --- END CODE ---- */ Thanks in advance for your help, TSalm |
February 20, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to TSalm | It seems this comes only from the "package" method.
The error is the same with this code :
/* --- CODE --- */
interface I
{
package void setFunc(int);
}
class A:I
{
int i;
package void setFunc(int i)
{ this.i = i ; }
}
void main()
{
I a = new A;
a.setFunc = 10;
}
/* --- END CODE --- */
> Hello,
>
> When I compile the code below, I've got the following error :
> OPTLINK (R) for Win32 Release 8.00.1
> Copyright (C) Digital Mars 1989-2004 All rights reserved.
> private_method_in_interface_file3.obj(private_method_in_interface_file3)
> Error 42: Symbol Undefined _D33private_method_in_interface_file31I4funcMFiZv
> --- errorlevel 1
>
>
> /* ----- CODE ------ */
> interface I
> {
> int func() ;
> package void func(int);
> }
>
> class A:I
> {
> int i;
>
> package void func(int i)
> { this.i = i; }
>
> int func()
> { return i; }
> }
>
> void main()
> {
>
> I a = new A ;
> a.func = 10 ;
> Stdout(a.func).newline ;
>
> }
> /* --- END CODE ---- */
>
>
> Thanks in advance for your help,
> TSalm
|
February 20, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to TSalm | TSalm wrote:
> Hello,
>
> When I compile the code below, I've got the following error :
> OPTLINK (R) for Win32 Release 8.00.1
> Copyright (C) Digital Mars 1989-2004 All rights reserved.
> private_method_in_interface_file3.obj(private_method_in_interface_file3)
> Error 42: Symbol Undefined _D33private_method_in_interface_file31I4funcMFiZv
> --- errorlevel 1
>
>
> /* ----- CODE ------ */
> interface I
> {
> int func() ;
> package void func(int);
> }
>
> class A:I
> {
> int i;
>
> package void func(int i)
> { this.i = i; }
>
> int func()
> { return i; }
> }
>
> void main()
> {
>
> I a = new A ;
> a.func = 10 ;
> Stdout(a.func).newline ;
>
> }
> /* --- END CODE ---- */
>
>
> Thanks in advance for your help,
> TSalm
I'm not sure but I think package is not virtual.
|
February 20, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Fri, Feb 20, 2009 at 3:56 PM, Jacob Carlborg <doob@me.com> wrote:
>
> I'm not sure but I think package is not virtual.
>
The compiler should catch that then.
|
February 20, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | >
> I'm not sure but I think package is not virtual.
:-(
So there's really no way to have a method declared "package" in an interface ?
|
February 21, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to TSalm |
TSalm wrote:
>>
>> I'm not sure but I think package is not virtual.
>
> :-(
> So there's really no way to have a method declared "package" in an
> interface ?
You also can't have a private function in an interface. This once lost me four days trying to figure out why my program wouldn't link despite the function very obviously being there.
Stick to public functions only.
-- Daniel
|
February 21, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Le Sat, 21 Feb 2009 04:00:42 +0100, Daniel Keep <daniel.keep.lists@gmail.com> a écrit:
>
>
> TSalm wrote:
>>>
>>> I'm not sure but I think package is not virtual.
>>
>> :-(
>> So there's really no way to have a method declared "package" in an
>> interface ?
>
> You also can't have a private function in an interface. This once lost
> me four days trying to figure out why my program wouldn't link despite
> the function very obviously being there.
>
> Stick to public functions only.
What a pity :(
Thanks.
|
February 23, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Last time I checked I could even use "override" to... erm, override methods that had package protection. The compiler didn't even complain, and I had to find out the hard way that the method wasn't virtual. |
February 23, 2009 Re: "Symbol undefined" on interface with public getter and package setter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Daniel Keep wrote:
>
> TSalm wrote:
>>> I'm not sure but I think package is not virtual.
>> :-(
>> So there's really no way to have a method declared "package" in an
>> interface ?
>
> You also can't have a private function in an interface. This once lost
> me four days trying to figure out why my program wouldn't link despite
> the function very obviously being there.
>
> Stick to public functions only.
>
> -- Daniel
Double thanks! I ran into this issue just a day or two ago.
|
Copyright © 1999-2021 by the D Language Foundation