Mailinglist Archive: opensuse-programming (25 mails)

< Previous Next >
[opensuse-programming] C++ inheritance issue
  • From: Jerry Feldman <gaf@xxxxxxx>
  • Date: Fri, 27 Apr 2007 14:46:46 -0400
  • Message-id: <20070427144646.02efa227@xxxxxxxxxxx>
I have a case where the compiler is giving me an error:
./FOO.H: In member function
Bar<ItemType>::operator()(ItemType&)': 
./FOO.H:447: error: `i_key' was not declared in this scope

Class bar is defined:
template <class ItemType>
class Bar public FuBar<ItemType, type_t>

And, i_key is defined as a protected member of FuBar:
template <class ItemType, class ThisType>
class FuBar : public Another<ItemType>, public RWTPtrorderedVector<ItemType>
.....
protected:
    ThisType const & i_key;

I'm using g++ version 3.4.5. 
g++ -MMD -MP -g -O3 -Wall -fpic -D__linux_x86_64__ -I. 
-I/<other included dirs> -D_RWCONFIG_rmd   -c Foo.C -o Foo.o

I can easily work around by adding a public accessor function, but this code does work on other company builds, but this is a simply access to a protected data element that should be visible from inheriting classes.
-- 
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
< Previous Next >
Follow Ups