[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
 

Forstaaelse problemmer i c++



Hej

Jeg er igang med at lave wet lille project i c++, og er l/obet ind i et
lille problem.

F/olgende program illustrerer problemet:

#include <string>
using namespace std;

int main(){
  string s1;
  string s2();

  s1 = "test af s1";
  s2 = "test af s2"; //compiler fejl her
  //her er fejlen
  //test.cpp: In function 'int main()':
  //test.cpp:11: error: assignment of function 'std::string s2()'
  //test.cpp:11: error: cannot convert 'const char [11]' to
  //             'std::string ()()' in assignment

  return 0;
}

Jeg trode at de 2 variable defineringer gjorde det samme, eller med andre
ord at default constructorn altid blev kaldt, og at default constructoren
er constructoren der ikke tager nogen argumenter.

Haaber der er nogen der ude som kan forklare hvad der endtlig sker, og
hvorfor

MVH
Allan W. Nielsen




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2008-04-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] *