[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

c++ templates, nedarvning og g++



Jeg har noget kode som oversættes fint med g++-2.95 men ikke med g++-3.4. Hvorfor virker nedarvningen ikke med 3.4 ?
Hvad er forklaringen / Hvad er den gode (generelle) løsning ?


-- temp.cc ------------------

template <class T>
class A
{
public:
protected:
  int i;
  T x;
};

template <class T>
class B : public A<T>
{
public:
	B();
};

template <class T>
B<T>::B(){
  i = 33;
}

-------------------------------
Med g++-2.95 går det fint:

sslug@sslug g++-2.95 -c temp.cc

Men med g++-3.4 får jeg:

sslug@sslug g++ -c temp.cc
temp.cc: In constructor `B<T>::B()':
temp.cc:21: error: `i' undeclared (first use this function)
temp.cc:21: error: (Each undeclared identifier is reported only once for each function it appears in.)



På forhånd tak /Kristian ( debian sarge )


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-10-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *