PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > method in different cpp file
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
method in different cpp file

Réponse
 
LinkBack Outils de la discussion
Vieux 26/02/2008, 11h22   #1
carmelo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut method in different cpp file

'Hi,I need to use in main.cpp, a method that is defined in
another .cpp file. How can I do it?
  Réponse avec citation
Vieux 26/02/2008, 12h05   #2
Gianni Mariani
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: method in different cpp file

carmelo wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in
> another .cpp file. How can I do it?


See some docs on how #include directives are used.
  Réponse avec citation
Vieux 26/02/2008, 12h19   #3
zhangyw80@yahoo.com.cn
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: method in different cpp file

On 2ÔÂ26ÈÕ, ÏÂÎç8ʱ05·Ö, Gianni Mariani <gi4nos...@mariani.ws> wrote:
> carmelo wrote:
> > 'Hi,I need to use in main.cpp, a method that is defined in
> > another .cpp file. How can I do it?

>
> See some docs on how #include directives are used.


you can put the declaratin of this method to the beginning of
the .cpp file where you call this method.
  Réponse avec citation
Vieux 26/02/2008, 12h31   #4
keith@bytebrothers.co.uk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: method in different cpp file

On 26 Feb, 11:22, carmelo <carmelo.abr...@gmail.com> wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in
> another .cpp file. How can I do it?


In addition to the responses you've had, I would add that if (and you
don't state, so I don't know) your question relates to templates, you
might want to check out the FAQ at http://www.parashift.com/c++-faq-lite/templates.html
  Réponse avec citation
Vieux 26/02/2008, 14h00   #5
nurxb01
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: method in different cpp file

On Feb 26, 4:22pm, carmelo <carmelo.abr...@gmail.com> wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in
> another .cpp file. How can I do it?



You can use header file , source file approche.
Declare the function in the header file and provide the defination in
the source file.
Include this header file using #include statement in the main.cpp.

  Réponse avec citation
Vieux 26/02/2008, 19h22   #6
Gianni Mariani
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: method in different cpp file

zhangyw80@yahoo.com.cn wrote:
> On 2ÔÂ26ÈÕ, ÏÂÎç8ʱ05·Ö, Gianni Mariani <gi4nos...@mariani.ws> wrote:
>> carmelo wrote:
>>> 'Hi,I need to use in main.cpp, a method that is defined in
>>> another .cpp file. How can I do it?

>> See some docs on how #include directives are used.

>
> you can put the declaratin of this method to the beginning of
> the .cpp file where you call this method.


Sure, but in practice it is done with header files and pointing him in
the header file direction will prolly give him the best chance of
getting it.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h56.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08852 seconds with 14 queries