|
-
June 23rd, 2006, 01:04 PM
#3
Re: Abstract
 Originally Posted by joncaves
if a class has a pure-virtual function then is is abstract - and to make this clear to anyone reading the code it is probaly best if you specify this at the class-head (after all the single pure-virtual function that makes the class abstract may be buried several screens down in the class definition).
If someone tries to instantiate my class or derives a class from it without implementing the pure virtual function the compiler gives him an error. And the compiler should only give him the error but not me any warnings.
 Originally Posted by joncaves
But a class can be abstract even if there are no pure-virtual functions - all abstract means is that you have to extend this class if you want to uses - a pure virtual function requires this - but there are other circumstances in which it can arise.
If I don't want my class to be instanciated I make the constructor protected. So there is absolutely no need for the abstract keyword.
 Originally Posted by joncaves
We gave you the ability to use the 'abstract' keyword instead of '= 0' (and the term' pure virtual function') as abstract is the term that is widely used in OOP for this situation while 'pure virtual function' is a C++-ism.
Google Fight says "pure virtual function" wins over "abstract function" with more than twice as much results ;-)
http://www.googlefight.com/index.php...ct+function%22
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|