473,394 Members | 1,722 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,394 software developers and data experts.

constuctors and object arrays

I want to pass parameters to the consructor when i create an array of
objects like this for a single object

Object *pSprite;

pSprite=new Object(1,1);

dynamicly created object array

Object *pSprite;

pSprite=new Object[5];

How do i combine the two
Mar 20 '07 #1
2 1308
On 20 Mar, 12:23, "tripleF" <s...@night.co.ukwrote:
I want to pass parameters to the consructor when i create an array of
objects like this for a single object

Object *pSprite;

pSprite=new Object(1,1);

dynamicly created object array

Object *pSprite;

pSprite=new Object[5];

How do i combine the two
You don't, but you can use a vector to much the same effect:

std::vector<Objectv(5, Object(1,1));

--
Erik Wikström

Mar 20 '07 #2
This was multiposted to comp.lang.c++.moderated. Please do not
multipost nor crosspost when unnecessary.

tripleF <sk*@night.co.ukwrote:
I want to pass parameters to the consructor when i create an array of
objects like this for a single object

Object *pSprite;

pSprite=new Object(1,1);

dynamicly created object array

Object *pSprite;

pSprite=new Object[5];

How do i combine the two
Answered in comp.lang.c++.moderated.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Mar 20 '07 #3

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...
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...
3
by: Marco | last post by:
Hello there, We're new to C# and have noticed a strange behaviour which we don't yet understand. We wrote a COM DLL (in VC++ 6.0) which performs some calculation based on some double arrays...
14
by: Szabolcs Borsanyi | last post by:
Deal all, The type typedef double ***tmp_tensor3; is meant to represent a three-dimensional array. For some reasons the standard array-of-array-of-array will not work in my case. Can I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.