Question: In a client-server code, can there be polymorphism possible, like there is a [?] [?] in client code and try to be polymorphic from the server.
One minute response: I don't understand the question, but you can certainly use polymorphism profitably in client-server design; for example, you can treat the various messages classes polymorphically in terms of a single parent message class.
Question: Do we need to prefix virtual to child destructors if we use it already in parents destructor?
One minute response: No; in that sense destructors are like any other member function.
Question: Why is it that we don't have any virtual constructors?
One minute response: Constructors consists of the name of the class being constructed; there's really no look-up needed, and so no need for either static vs. dynamic look-up (Or, I suppose you could argue, that the static and dynamic types are always the same).
Question: Why is polymorphism important? In practice, I cannot get a good design with this. Can I use design patterns instead?
One minute response: Polymorphism is important because it lets you abstract away differences in type, which lets you write more general code with the same (or a little bit more) work. As always, good design comes with practice. You don't have to choose between polymorphism and design patterns, you can use both.
Question: What are mix-ins?
One minute response: Ah, good question; I feel a lecture coming on. But until then, you can think of a mix-in as a small, self-contained class that provides a simple service, usually to another class. A class can name mix-in classes as parents and use the services made available by the mix-ins within the class itself. Mix-ins are similar to interfaces in Java, but, unlike Java interfaces, mix-ins usually have code. Mix-ins originally came from Common Lisp object system (CLOS).
This page last modified on 16 July 2003.