Boost logo

Boost Users :

Subject: Re: [Boost-users] Emulating Python class variables in C++
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-08-02 20:41:08


On 2/08/2015 20:05, Will Hall wrote:
> struct A {
> static string value;
> };
>
> struct B : public A {
> static string value;
> };
>
> string A::value("A");
> string B::value("B");

While I can't answer your question directly, I can tell you that this is
bad coding practice in C++. Usually it stems from a misunderstanding,
while other times it's just a bad design.

> So, to summarise, any idea how to provide polymorphic Python class
> variables in boost::python?

Static/class fields cannot be polymorphic, by definition.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net