Bonjour,
Je suis � la recherche d'une solution afin de pouvoir exploiter dans diff�rentes classes, une m�me donn�e commune.
Je pensai cr�er une classe "application" dont un attribut serait "cheminApplication", et de construire mes nouvelles classes en les h�ritant de ma classe "application".
A chaque fois que j'en ai besoin dans mes classes fille, j'acc�de � l'attribut "cheminApplication" de ma classe m�re.
Est-ce une bonne solution ? Feriez-vous diff�rement ?
Mon exemple me donne un r�sultat null.
Comment acc�der depuis mon traitement spool � l'attribut
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 int _tmain(int argc, _TCHAR* argv[]) { application ^ myApplication = gcnew application; spool ^ mySpool = gcnew spool; myApplication->cheminApplication = *argv; mySpool->traitementSpool(); }; void application::afficherChaineApplication() { printf("Chemin application : %ls\n",cheminApplication); }; void spool::traitementSpool() { printf("Chemin spool : %ls\n",cheminApplication); };
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 ref class application { public: _TCHAR* cheminApplication; void afficherChaineApplication(); }; ref class spool : public application { public: void traitementSpool(); };
Partager