[C++-sig] Abstract classes

Roman Yakovenko roman.yakovenko at actimize.com
Wed Jun 30 08:23:20 CEST 2004


Paul wrote:

> Pyste was generating constructors defs for abstract classes. 
> I've changed 
> Pyste so that it will insert no_init (and emit no 
> constructors) for abstract 
> classes.
> 
> Is this the correct behaviour for an abstract class?
> eg.
> class_< Foo, boost::noncopyable>("Foo", no_init)
> 
> This from the FAQ states this quite clearly:
> http://www.python.org/cgi-bin/moinmoin/boost_2epython_2fFAQ
> >     * no_init means "do not try to create an instance of 
> that Python object, create __init__ function that throws an exception"
> >     * noncopyable means "do not try to register a converter 
> which can convert C++ return values of that class to Python". 
> > 
> > When wrapping an abstract class, it's necessary to specify both. 
> 
> However, what's confusing me is that I thought specifying 
> no_init would make 
> the following incorrect:
> 
> class Bar(CppModule.Foo):
> 	def __init__(self):
> 		CppModule.Foo.__init__(self)
> 
> Is that correct?

I think this is correct. Abstract class has constructors. 

Roman

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.707 / Virus Database: 463 - Release Date: 6/15/2004
 





More information about the Cplusplus-sig mailing list