[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
 

SV: SV: [CPROG] C++ spørgsmål - hvad gårgalt med minstring?



>bliver. Altså, linkeren fejler i det første tilfælde, men ikke i det
>andet.
>
>Med mindre navnet eller typedef gør en afgørende forskel, så må det vel
>næsten være en fejl i g++, eller hvad? Eller har jeg bare stadig ikke
>fattet noget?

Programmet nedenfor oversætter og kører fint, gør den også det for dig?:

#include<iostream>
#include<string>

typedef struct {
  string AsString() const { return "a"; }
} ged_t;

class Ged {
public:

  string AsString() const { return "b"; }
};

int main() {
  ged_t a1 = ged_t();
  Ged b1 = Ged();
  const ged_t a2 = ged_t();
  const Ged b2 = Ged();

  cout << "a " << a1.AsString() << a2.AsString() << endl;
  cout << "b " << b1.AsString() << b2.AsString() << endl;

  return 0;
}

\Jonas



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 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] *