Killkillkill! 666! Fornicate!

May 12, 2005 19:39

The semester is nearly over. Counting the lecture I'm currently sitting in, there are three C++ lectures left, one of which will be devoted to a quiz ( Read more... )

Leave a comment

Comments 4

leora May 13 2005, 02:58:24 UTC
I'm really sorry.. although I don't understand why that's bad, I will assume that it is very bad.

Reply

marphod May 13 2005, 13:29:07 UTC
Mutliple inheretence, in and of itself isn't bad. It is complex and poorly done in C++.

It is the concept than an object can be multiple things. (in a programming sense, that a stream object can be both an input stream and an output stream. Like a person can be both an actor and a dentist.)

Virtual Functions are functions that say 'no matter what you think you're using, use the most specific version of this function'. So, if you have a Programmer object with a virtual calculateSalary function, and a ContractProgrammer object, you can use the ContractProgrammer as a Programmer most of the time. However, as they calculate salaries differently, you should always use the most specific version of that function.

Inheretence and multiple inheretence depend upon virtual functions heavily.

Reply

darch May 13 2005, 22:44:57 UTC
(I know you know this, but since you've gone and explained stuff anyway, I'll go ahead and explicate my disgust.)

More to the point, multiple inheritance is an advanced language feature that invites misuse. It's the sort of thing that should be mentioned as extant with an overview of the common pitfalls. Preferably, when you're filling time at the end of the course.

The virtual function is one of the fundamental mechanisms of polymorphism in C++. Understanding it is necessary to writing and understanding object-oriented code.

And we're going to mention them in passing in the last two lectures of the semester; I'm pretty sure the word "polymorphism" hasn't come up at all.

D'A

Reply


(The comment has been removed)

akiko May 13 2005, 16:59:08 UTC
And the antichrist.

Reply


Leave a comment

Up