digitalmars.D.learn - Abstract override behaviour
- Claudiu (30/30) Feb 05 2020 Hi dlang community,
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/7) Feb 05 2020 Andrei's book is a little dated. Here is the errata:
- Claudiu (4/12) Feb 05 2020 Thanks a lot, I'll need to keep this errata close for future
- Paul Backus (2/5) Feb 05 2020 https://p0nce.github.io/d-idioms/#Which-book-should-I-read?
Hi dlang community,
Just started to learn D using Visual Studio 2007, latest VisualD
(VisualD-v0.51.0-dmd-2.090.0-ldc2-1.19.0) and "The D Programming
Language" by Andrei Alexandrescu.
I am trying to run most of the examples and had a surprise at
chapter 1.6.1 "More Statistics. Inheritance" with the following
code:
interface Stat {
void accumulate(double x);
...
}
class IncrementalStat : Stat {
...
abstract void accumulate(double x);
...
}
class Min : IncrementalStat {
...
void accumulate(double x) { ... }
...
}
In class "Min" definition I am receiving this error: "cannot
implicitly override base class method
`IncrementalStat.accumulate` with `Min.accumulate`; add
`override` attribute"
After I update "Min" class to << override void accumulate(double
x) >> everything works fine.
Can anybody clarify where is the problem.
Thanks in advance,
Claudiu
Feb 05 2020
On 2/5/20 8:49 AM, Claudiu wrote:In class "Min" definition I am receiving this error: "cannot implicitly override base class method `IncrementalStat.accumulate` with `Min.accumulate`; add `override` attribute"Andrei's book is a little dated. Here is the errata: http://erdani.com/index.php?cID=109 Ali
Feb 05 2020
On Wednesday, 5 February 2020 at 16:55:42 UTC, Ali Çehreli wrote:On 2/5/20 8:49 AM, Claudiu wrote:Thanks a lot, I'll need to keep this errata close for future "surprises". I'm trying to learn idiomatic D. I think that this book is still relevant, but are there other recommended books?In class "Min" definition I am receiving this error: "cannot implicitly override base class method `IncrementalStat.accumulate` with `Min.accumulate`; add `override` attribute"Andrei's book is a little dated. Here is the errata: http://erdani.com/index.php?cID=109 Ali
Feb 05 2020
On Wednesday, 5 February 2020 at 17:11:28 UTC, Claudiu wrote:Thanks a lot, I'll need to keep this errata close for future "surprises". I'm trying to learn idiomatic D. I think that this book is still relevant, but are there other recommended books?https://p0nce.github.io/d-idioms/#Which-book-should-I-read?
Feb 05 2020








Paul Backus <snarwin gmail.com>