Sujet : Re: Other programming languages (Was: Command line globber/tokenizer library for C?)
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 13. Sep 2024, 03:06:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vc06o4$l86t$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 13.09.2024 00:32, Lawrence D'Oliveiro wrote:
On Thu, 12 Sep 2024 17:40:17 +0200, Janis Papanagnou wrote:
A lot of early C++ programs I've seen were just, umm, "enhanced" "C"
programs.
Given that C++ makes “virtual” optional instead of standard behaviour, I’d
say that C++ is in fact designed to be used that way.
There's different semantics with and without a 'virtual' specification.
Even if you want polymorphism (and have to use 'virtual') there's no
need to define it as _default_ (and "disable" it where unnecessary).
A language designer is free to have it explicitly specified for that.
Given that C++ has its paragon in Simula it's not surprising that it
has been defined in a similar way; to explicitly declare it virtual.
(Other OO languages may have that differently designed. But I won't
engage in any "real" OO languages have 'virtual' defined as default
sort of discussions. - It is fine for me as it is in Simula or C++.
If you want to program in OO paradigm just specify 'virtual'.[*])
Janis
[*] Note: The Simula compiler I use nowadays is Cim. And Cim has a
serious bug where specifying 'virtual' does not work as specified;
it's actually ineffective. I discovered an alternative non-standard
syntax specification that makes polymorphism work in Cim. (Search
the Web/Usenet or just ask or mail me if interested in the details.)