473,385 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1533
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
if (is_array($_POST)) { foreach ($this->getAssocSectionsObjArray($key, $dbAP) as $obj) { print_r($obj); print_r(" in array? "); print_r(in_array($obj, $result)); print_r("<P>"); if...
106
by: A | last post by:
Hi, I have always been taught to use an inialization list for initialising data members of a class. I realize that initialsizing primitives and pointers use an inialization list is exactly the...
6
by: marktm | last post by:
Hi- I am trying to use setInterval to call a method within an object and have not had any luck. I get "Object doesn't support this property or method" when I execute the following code. What I...
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
5
by: Mike Carroll | last post by:
I have a COM server that's generally working ok. But one of its methods, when the IDL gets read by the Intertop layer, has parameters of type "out object". The C# compiler tells me that it...
3
by: Christoph Boget | last post by:
Please forgive my ignorance as I'm still new to developing w/C# (and in windows in general). So if I use the wrong terms, please bear with me. I'm using VS.NET and defining the events have been...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
2
by: xllx.relient.xllx | last post by:
Assuming compiler optimizations are set to off, specifically to not allow the compiler to elide the copy constructor, would the following hold true?: If you call a function with an user-defined...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
1
tlhintoq
by: tlhintoq | last post by:
I'm pretty sure this is language independent and is going to be the same whether it's VC or C# - but my project is C# WIndows Forms just in case. Does anyone have a good handle on the sequence of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.