digitalmars.D.learn - overriding methods
- stunaep (8/16) Apr 05 2016 I get a deprecation warning with @Override, but I was unable to
- Adam D. Ruppe (3/5) Apr 05 2016 What error message exactly are you getting and on what code?
- stunaep (9/14) Apr 05 2016 I had no error on the examples I posted, only when using
- Adam D. Ruppe (3/12) Apr 05 2016 Yeah, that just means use the override keyword on the method.
- =?UTF-8?Q?Ali_=c3=87ehreli?= (6/9) Apr 05 2016 Note that it doesn't say _instead of Override_. Override is an undefined...
- pineapple (4/7) Apr 05 2016 Unlike in Java, D's override indicator doesn't look like an
I get a deprecation warning with Override, but I was unable to find the proper way to do it. Am I meant to add override before the method like this?override public void startThread(Thread t, int pri) { ... }Am I meant to wrap the entire method in override { } like this?override { public void startThread(Thread t, int pri) { ... } }Both of them compile, so I'm wondering which to use. Is override {} supposed to be for adding multiple methods inside to avoid writing override before each method, or is putting override in front of the method without brackets just wrong?
Apr 05 2016
On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote:I get a deprecation warning with Override, but I was unable to find the proper way to do it.What error message exactly are you getting and on what code? Both styles you put there should work equally well.
Apr 05 2016
On Tuesday, 5 April 2016 at 18:42:33 UTC, Adam D. Ruppe wrote:On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote:I had no error on the examples I posted, only when using Override previously. It just says to use override attribute instead of Override source\game\client.d(8,20): Deprecation: implicitly overriding base class method game.GameWindow.startThread with game.client.Client.startThread deprecated; add 'override' attribute source\game\client.d(7,3): Error: undefined identifier 'Override'I get a deprecation warning with Override, but I was unable to find the proper way to do it.What error message exactly are you getting and on what code? Both styles you put there should work equally well.
Apr 05 2016
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote:I had no error on the examples I posted, only when using Override previously. It just says to use override attribute instead of Override source\game\client.d(8,20): Deprecation: implicitly overriding base class method game.GameWindow.startThread with game.client.Client.startThread deprecated; add 'override' attribute source\game\client.d(7,3): Error: undefined identifier 'Override'Yeah, that just means use the override keyword on the method. There is no Override thing, it is a plain lowercase keyword.
Apr 05 2016
On 04/05/2016 11:54 AM, stunaep wrote:when using Override previously. It just says to use override attribute instead of Overridesource\game\client.d(7,3): Error: undefined identifier 'Override'Note that it doesn't say _instead of Override_. Override is an undefined symbol in your code. Override is user defined attribute (UDA) syntax. The programmer is responsible for defining the semantics of user defined attributes. Ali
Apr 05 2016
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote:I had no error on the examples I posted, only when using Override previously. It just says to use override attribute instead of OverrideUnlike in Java, D's override indicator doesn't look like an annotation, it's just a keyword placed before a method along the same lines as "static" or "public" or "protected".
Apr 05 2016