Bonjour,
Tout d'abord, voici le contenu de mon fichier "classes.h"
Puis "classes.cpp" :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 #define MAX_FREQUENCY 2000 #define MIN_FREQUENCY 10 #define MAX_AMPLITUDE 5 #define MIN_AMPLITUDE 0 #define MAX_OFFSET 5 #define MIN_OFFSET 0 #define MAX_DCICLE 0.8 #define MIN_DCICLE 0.2 class Parameters{ //---Attributs privés float value, minAllowed, maxAllowed; public: //---Constructeur Parameters(float maxAllowed, float minAllowed); //---Méthodes float get(); void set(float value); }; class Signal{ public: //---Attributs publics Parameters frequency(float max = MAX_FREQUENCY, float min = MIN_FREQUENCY), amplitude(float max = MAX_AMPLITUDE, float min = MIN_AMPLITUDE), offset(float max = MAX_OFFSET, float min = MIN_OFFSET), dCicle(float max = MAX_DCICLE, float min = MIN_DCICLE); //---Constructeur Signal(); //---Méthodes };
Curieusement, après avoir instancié ma classe dans la fonction main par :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "classes.h" //CLASSE PARAMETERS //---Constructeur Parameters::Parameters(float maxAllowed, float minAllowed){ this->maxAllowed = maxAllowed; this->minAllowed = minAllowed; } //---Méthodes float Parameters::get(){ return this->value; } void Parameters::set(float value){ if( (value < maxAllowed) && (value > minAllowed) ){ this->value = value; } } //CLASSE SIGNAL //---Constructeur Signal::Signal(){ } //---Méthodes
Signal signal();
Je n'arrive pas à faire :
signal.amplitude().get();
Avec pour erreur :
Pouvez-vous m'aider ?main.cpp:14: error: request for member `amplitude' in `signal', which is of non-class type `Signal ()()'
Merci d'avance
Partager