GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Jan-2009, 12:32
Sal Bruno Sal Bruno is offline
New Member
 
Join Date: Jan 2009
Posts: 5
Sal Bruno is on a distinguished road

How to access C++ function


I am a new user of C++ and need to know how to call the changeprompt from another module. Details follow.

Module A.cc contains code like this:

CPP / C++ / C Code:
  void inode::changeprompt (const string &new_prompt) {

  }

Module A.h contain code like this:

CPP / C++ / C Code:
  class inode {
     public:
        void changeprompt (const string &new_prompt);
  };
Last edited by LuciWiz : 18-Jan-2009 at 12:44. Reason: Please insert (only) your C++ code between [cpp] & [/cpp] tags
  #2  
Old 19-Jan-2009, 07:06
L7Sqr L7Sqr is offline
Member
 
Join Date: Jul 2005
Location: constant limbo
Posts: 234
L7Sqr is a jewel in the roughL7Sqr is a jewel in the rough

Re: How to access C++ function


If you only want to call the method then you would create an object of type inode and use it like
CPP / C++ / C Code:
int main () {
   inode * i = new inode ();
   i->changeprompt("My new prompt: ");
   // ...
   delete i;
   return 0;
}
If you are looking to define the method (since the example you provide has no definition) then you just need to put the relevant code between the open and close beraces { }.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
run script command on ns2.26 newbie06 Computer Software Forum - Linux 65 19-Aug-2009 08:50
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 08:44
Flex and bison coding lucky88star C++ Forum 5 24-Dec-2007 12:57
Need Help with input files. Efferus C++ Forum 2 24-Nov-2007 17:19
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 14:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:10.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.