This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaredgrubb
Recipients georg.brandl, jaredgrubb
Date 2009-02-23.05:11:36
SpamBayes Score 6.464744e-09
Marked as misclassified No
Message-id <1235365898.93.0.530994283024.issue5349@psf.upfronthosting.co.za>
In-reply-to
Content
On page library/abc.html documenting abc.abstractmethod, the following
text about C++ is placed in a note:

"Note: Unlike C++’s pure virtual functions, or Java abstract methods,
these abstract methods may have an implementation. This implementation
can be called via the super() mechanism from the class that overrides
it. This could be useful as an end-point for a super-call in a framework
that uses cooperative multiple-inheritance."

This is not an accurate description of C++'s pure virtual functions.
Pure virtual functions CAN have an implementation, which can be called
from derived classes; this makes them behave just like Python's
abstractmethod.

Example:
struct Abstract {
   virtual void foo() = 0;
};
void Abstract::foo() {
   std::cout << "pure virtual function called";
}
struct Derived : public Abstract {
   virtual void foo() { 
       Abstract::foo(); // call the abstract impl
   }
};
History
Date User Action Args
2009-02-23 05:11:39jaredgrubbsetrecipients: + jaredgrubb, georg.brandl
2009-02-23 05:11:38jaredgrubbsetmessageid: <1235365898.93.0.530994283024.issue5349@psf.upfronthosting.co.za>
2009-02-23 05:11:37jaredgrubblinkissue5349 messages
2009-02-23 05:11:36jaredgrubbcreate