array-of-objects

How do I create objects at runtime?

I need to make a number of distinct objects of a class at runtime. This number is also determined at runtime. Something like if we get int no_o_objects=10 at runtime. Then I need to instantiate a class for 10 times. Thanks ...

How to access js object properties via html element?

Hi, I have an array of objects fetched using jQuery.getJSON(). I want every one of my objects to be represented by HTML div element, so when you click the element you have access to all the properties of corresponding object. What is the best way to do it? I wanted to do it like this: $('.mydiv').click(function() { var id = $(this)....

How to delete object from array inside foreach loop?

Hi, I iterate through an array of objects and want to delete one of the objects based on it's 'id' property, but my code doesn't work. foreach($array as $element) { foreach($element as $key => $value) { if($key == 'id' && $value == 'searched_value'){ //delete this particular object from the $array uns...

C++, array of objects without <vector>

Hello I want to create in C++ an array of Objects without using STL. How can I do this? How could I create array of Object2, which has no argumentless constructor (default constructor)? ...

Within an aray of objects can one create a new instance of an object at an index?

Here's the sample code: class TestAO { int[] x; public TestAO () { this.x = new int[5] ; for (int i = 0; i<x.length; i++) x[i] = i; } public static void main (String[]arg) { TestAO a = new TestAO (); System.out.println (a) ; TestAO c = new TestAO ...

Setting synthesized arrays causing memory leaks using nested arrays

Hello: Why is the following code causing a memory leak in an iPhone App? All of the initted objects below leak, including the arrays, the strings and the numbers. So, I'm thinking it has something to do with the the synthesized array property not releasing the object when I set the property again on the second and subsequent time this ...