470,866 Members | 1,943 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,866 developers. It's quick & easy.

Object as Argument?

Hello,

I have written a small program which creates a small object from a class:

---------------
#include "Object.hpp"
Object obj;
obj.init();
std::cout << obj.no << std::endl;
---------------
Result an integer stored in obj.no

Works fine and everything is OK. Now I want to start from this program a
new program with system. And with the systemcall I want to commit the
object from the 1. program to the 2. program:

--------------
// program 1
system("program2 obj");
--------------
// program 2
#include "Object.hpp"
int main(Object obj) {
std::cout << obj.no << std::endl;
}
--------------

Result: anything but not what is declared in Object::init();

How can I solve this? I think I'm on the wrong way, even with this
system("..."). I just want to create an object only one time and commit
this to program2 without creating it a second time. Is this possible in
any way?

Thank, Marek
Mar 1 '06 #1
1 1431
Marek Franke wrote:
Hello,

I have written a small program which creates a small object from a class:

---------------
#include "Object.hpp"
Object obj;
obj.init();
std::cout << obj.no << std::endl;
---------------
Result an integer stored in obj.no

Works fine and everything is OK. Now I want to start from this program a
new program with system. And with the systemcall I want to commit the
object from the 1. program to the 2. program:

--------------
// program 1
system("program2 obj");
--------------
// program 2
#include "Object.hpp"
int main(Object obj) {
std::cout << obj.no << std::endl;
}
--------------

Result: anything but not what is declared in Object::init();

How can I solve this? I think I'm on the wrong way, even with this
system("..."). I just want to create an object only one time and commit
this to program2 without creating it a second time. Is this possible in
any way?


Yes, but it's platform dependent. Look up CORBA or COM.

Cheers! --M

Mar 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Phil Powell | last post: by
106 posts views Thread by A | last post: by
5 posts views Thread by Mike Carroll | last post: by
3 posts views Thread by Christoph Boget | last post: by
26 posts views Thread by yb | last post: by
2 posts views Thread by xllx.relient.xllx | last post: by
275 posts views Thread by Astley Le Jasper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.