* al pacino in private correspondence:
Alf P. Steinbach wrote: * al pacino:
i wanted to know how it prohibits the creation of
the instance.
Please quote what you're replying to.
Anyway, I don't understand the question.
Perhaps you're wondering what error message you get (if any)?
That depends on your compiler.
Try the following code with your most favorite compiler:
struct Huh { virtual foo() = 0; };
int main() { Huh x; }
how does it decides that since this class is abstract
If a class has a pure virtual function, like Huh above, then it's
abstract at the language level.
any instance in source code is illegal and no memory is allocated for
that class etc etc.
Well, that's not strictly true.
"""> > any instance in source code is illegal and no memory is
allocated for"""
"""> Well, that's not strictly true.""""
please elobrate more on that.
Please reply in the newsgroup. That way others can benefit from the
discussion, my mailbox doesn't fill up :-), and not the least, others
can criticize and participate in the discussion, e.g. correcting me...
Regarding "instance in source code", you can form an instance of an
abstract class by using it as a base class for a concrete class.
struct Abstract { virtual void foo() = 0; };
struct Concrete: Abstract { void foo() {} };
int main(){ Concrete c; Abstract& a = c; }
Here 'a' refers to the (now concrete) Abstract part of 'c'.
Probably what was meant wherever you picked up that, is that an abstract
class cannot be instantiated directly: it can only be instantiated as
part of a concrete class.
Regarding "no memory is allocated for", I'm not sure what's meant, but
it sounds wrong... :-)
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?