13. juni 2005 - 23:39
Der er
8 kommentarer
default argumenter
Kan man lave noget i c++ som man kan i f.eks. php.
Hvis man har en funktion f.eks. function(int a, int b)
kan man så lave noget smart med at hvis ikke argumentet b er angivet så er det som standard f.eks. 0? f.eks. function(int a, int b = 0);
eller skal man lave forskellige functioner ala:
function(int a) { a = a; b = 0; }
6 D:\CPP\FilmDB\tfilm.cpp default argument given for parameter 1 of `TFilm::TFilm(std::string, int, std::string, std::string, int, std::string)'
14 D:\CPP\FilmDB\tfilm.h after previous specification in `TFilm::TFilm(std::string, int, std::string, std::string, int, std::string)'
D:\CPP\FilmDB\tfilm.cpp In constructor `TFilm::TFilm(std::string, int, std::string, std::string, int, std::string)':
6 D:\CPP\FilmDB\tfilm.cpp default argument missing for parameter 2 of `TFilm::TFilm(std::string, int, std::string, std::string, int, std::string)'
TFilm::TFilm(string title = "", int year, string actors, string language, int rating, string comment) {}