Bon, j´arrive un peu tard
Pas grave, j´ai une question aussi, un petit problème avec les gabarits:
Voilà le code de l´include ( sans la sentinelle):
- include s_classes
template <class P>
class HProperty{
friend HModStatus;
friend HLight;
private: void ( *GetValue) ( P &);
void ( *SetValue) ( P &);
HProperty(void ( *GetV) ( P &), void ( *SetV) ( P &));
public: operator P ( );
P& operator = ( P &);
}
et celui du source:
- include <s_includes.h>
- include s_property
template <class P> HProperty<P>::HProperty(void ( *GetV) ( P &), void ( *SetV) ( P &))
{
#ifndef HDEBUG //pas de debuggage
GetValue = GetV;
SetValue = SetV;
#else //debuggage
if ( (!GetV)||(!SetV))
{
//Instructions d´avertissement
}
GetValue = GetV;
SetValue = SetV;
#endif
}
template <class P> HProperty<P>::operator P()
{
P result;
GetValue(P);
return P;
}
template <class P> P& HProperty<P>::operator = ( P& NewValue)
{
#ifndef HDEBUG
SetValue(P);
#else
if ( !P)
{
//Instructions d´avertissement
}
SetValue(P);
#endif
}
Et quand je compile tout ça le compilo se fout de ma gueule en me renvoyant 4 fois les mêmes erreurs, mais voilà ce que j´ai retenu:
5: semicolon missing after declaration of `HProperty<P>´
5: parse error before `template´
9: ANSI C++ forbids declaration `SetValue´ with no type
9: `SetV´ was not declared in this scope
20: parse error before `}´
In method `HProperty<P>::operator P()´:
26: parse error before `)´
28: parse error before `;´
In method `P & HProperty<P>::operator =(P &)´:
34: parse error before `)´