m_subject

Patrick Julien freak at codepimps.org
Fri Nov 21 01:30:21 CET 2003


On November 19, 2003 03:24 pm, Boudewijn Rempt wrote:
> While working on tools again, I noticed that there's a private
>
> 	KisCanvasSubject *m_subject;
>
> in both kis_tool_non_paint and in its descendants, with
>
> 	void KisToolColorPicker::update(KisCanvasSubject *subject)
> 	{
> 		super::update(subject);
> 		m_subject = subject;
> 	}
>
> updating both the parent's member variable and the object's own m_subject.
> Is there a reason for that design -- i.e., is this preferable to making
> m_subject protected?

Yes, there is 3 types of inheritance:

1) Interface
2) Implementation
3) Data

I do not use data inheritance for all the same reasons I don't use global 
variables.  I understand why this was necessary to add them to C++ in the 
first place, see "The Design and Evolution of C++" for a rational, but it 
doesn't mean I use it under normal circumstances.

Of course, it makes you wonder why more modern languages even support this 
feature in the first place :)




More information about the kimageshop mailing list