[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: [CPROG] C++ problem



Hej Carsten
default constructoren for built-in types skal returnere 0 (eller hvad der 
svarer til);
int(0) === int()

for custom-defined-classes er dette afhængig af definitionen;
men bør også overholde ovenstående;

Derfor burde du kunne bruge
CAverage(): n(), x() {};  // virker efter min bedste overbevisning
Alternativt:
CAverage(): n(0), x(T()) {}; // *SKAL* virke
Alternativt:
CAverage(): n(0) { x= T(); }; // Opdater din compiler!

template<class T>
class CAverage
{
  private:
    unsigned int n;
    T x;
  ...
}

mvh
Nils Åke Ljunggren


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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