Polymorphism in C++
C++ implements subtyping polymorphism in the form of
virtual functions, member functions that should be overridden on derived classes, in a way each class implements its own behavior for the function:
virtual void f() = 0;
virtual ~Interface() = default;
struct A : public Interface
void f() overrides
std::cout << "A!" << std::endl;
struct B : public Interface
void f() overrides
std::cout << "B!" << std::endl;
This is an original text by Eax Melanhovich that was rigourosly translated and kindly shared by Andrey Karpov. The original translation can be found here. Many thanks to both.
Why C and C++ Will Never Die
I couldn’t but notice how much interest the readers of this blog [the author’s blog] had shown in the topic “should we let kittens play with new balls of wool?” So I felt like sharing a few more of my reflections on a related subject in regard to the C and C++ languages and the odds that Rust will kill them. No need to tell you that it will inevitably cause a big holy war, so before you proceed, think twice if you really want to go on reading this post and especially participate in a “constructive debate” via comments.
A couple of days ago I was studying at my university library when my colleague Miguel Madrid got up and started to traverse the library looking for programming books. It’s a game we usually play, to find out a good quality book in a place full of Java 2 SE manuals…
There are some gems on that library though. There’s a couple of copies of Alexandrescu’s “Modern C++ Design” (No longer that Modern, right?) and “C++ Template Metaprogramming”, the latter only borrowed by me in the last five years according to the registry. I always try to have a copy of both, it’s easy since there are only a few people doing C++ there, never reaching the “TMP mental asylum” I’m usually in.
But that day, Miguel reached me with a copy of “The Pragmatic Programmer”. “One of the most influential books in the history of software engineering” the cover says. I’m so scared of how software engineering examples look like…