[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
 

Re: [PROGRAMMERING] c++ templates, nedarvning og g++



Onsdag den 14. september 2005 13:00 skrev Kristian Nørgaard:
> 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 / 

3.4 er langt mere standard compliant. Fra release notes: In a template 
definition, unqualified names will no longer find members of a dependent base 
(as specified by [temp.dep]/3 in the C++ standard).

> 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;

brug
A<T>::i = 33;

> }

Du kan læse mere om det her:

http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
"What we're seeing with Web sites that are viewable only with IE is the
privatization of the Web," said Mozilla's Baker. "And that's a dangerous
setting. We're moving toward a world where all the capabilities of the
Internet are reprocessed through a single filter, with Microsoft's business
plan behind it."
               - news.com, 20020709


 
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] *