Using classes instead of C/C++ style structs?
Posted: Sat Feb 24, 2007 4:36 am
Hi,
This isn't so much a problem but (perhaps) a solution.
One of the downfalls of PHP is that it does not allow structs, for example:
You can then pass these structures between functions after popluating them with data. I don't like associative arrays, because they don't behave in exactly the same way. Wouldn't a solution to the above problem however be something like
Which you could then pass between functions like a C/C++ style struct?
Just a thought.
This isn't so much a problem but (perhaps) a solution.
One of the downfalls of PHP is that it does not allow structs, for example:
Code: Select all
struct REC_PRODUCT
{
TCHAR szProductID[PRODUCTID_SZLEN];
int64 nSalesPrice;
int64 nCostPrice;
TCHAR szSupplierID[SUPPLIERID_SZLEN];
};Code: Select all
class REC_PRODUCT
{
char szProductID[PRODUCTID_SZSLEN];
int nSalesPrice;
int nCostPrice;
char szSupplierID[SUPPLIERID_SZLEN];
}Just a thought.