instantiating

instantiating a new class in a loop or not in a loop?

require_once('Class.php'); $myArray = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // etc which is correct? foreach($myArray as $key => $val) { $class = new Class(); $result = $class->someMethod($val); } or $class = new Class(); foreach($myArray as $key => $val) { $result = $class->someMethod($val); } Edited to be more...

Creating a UITouch object

In my iPhone app I'm overriding the touchesBegan:withEvent method in my view and what I want to do is make some tweaks to the UITouch object found in the NSSet and send it to another view. I couldn't find anywhere how to create a UITouch object. Any ideas? thanks, fbr ...

different type of instantiating on c++

Hey there , since I've came from c# to c++ everything looks crazy for me in c++. I just wondering If someone could explain me why do we have these kind of instantiating in c++ : method 1: ClassA obj1; // this is going to stack method 2: ClassA *obj1 = new ClassA(); //this is going to heap whereas we don't have the common instantia...

Objective-c: Dynamic Class Names

I'm not sure if I worded the subject correctly. I am looping through an array, within each loop I am trying to instantiate a class, but I want to dynamically create the name. Like so: int i = 0; for(NSString* thisdatarow in filedata) { i++; NSString* thisad = [NSString stringWithFormat:@"ad%d", i]; NSLog(@"%@", thisad); ...