Hi,
Is there a way to add a constructor to initialize a struct instance. I need to pass this as a parameter as shown in the code fragment.
thanks,
Don
// section from CU.ice:
module CU
{
// Transaction, becomes CU_Transaction
struct Transaction {
string posteff;
int account;
...
}
bool transfer(Transaction from, Transaction to) throws PostError;
}
// testing usage of transfer from PHP
$xferfrom = array ("posteff" => "2006-05-15","account" => (int)12345, "suffix" => (int)51, "accttype" => "S","mnemonic" => "SDT", "amount" => (double)12345.67);
$fromshr = new CU_Transaction($xferfrom);
// constructor doesn't work, so initialize the hard way
$fromshr->posteff = '2006-05-16';
$fromshr->account = 2;
$fromshr->accttype = 83;
$fromshr->suffix = 1;
$fromshr->mnemonic = 'SWX';
$fromshr->amount = 100;
$fromshr->descr = 'xfer test from php';
// now post the transfer
$ok = $gcu->transfer($fromshr, $toshr);
// it works!, PHP and Ice are Great!

Reply With Quote