![]() |
Objective C Memory Management problems
1 Attachment(s)
I am trying to create a program that is intended to be a bank simulation. So, I made an account class which will hold each account, and a bank class, which is supposed to represent the main bank.
I have attached the files below. please have a look at them, they are not very long. My problem is that at my main I want to find a way to make a loop which will insert accounts into the bank. I could do this with a while statement, but I chose the 'for' loop for testing purposes. Can you tell me how am I going to do this and be 'memory management-friendly'? I have managed to insert the values into the bank, but not also release the objects properly! :
#include <iostream>1)When I add an object to an NSArray, isn't that element deeply copied into the NSArray? Why does this happen? 2)How can I fix the problems I am having with my program? These memory management problems are driving me nuts. Any help will be greatly appreciated. |
Try using GlobalAlloc. It's a windows API function (include windows.h). Um, besides that, I's like to mention, that you're using C++ not C, C doesn't have classes.(it's just a matter of sematics, ignore what I said) C and C++ are different. C++ has OOP. C doesn't. C++ has classes. C doesn't.
|
But this isn't C, or C++. Its Objective C
|
Apparently dragon master doesn't know what he is talking about.
|
1 Attachment(s)
Quote:
The code I presented is Objective-C++, not plain C++. Anyway, I fixed the problem long ago, and for everyone that's interested on how to solve this problem, here is the code for it: (as you can see, I am porting the same program to different languages just for exercising :) ) This time I used plain Objective C, as Obj C++ caused me problems, and also I had no particular reason of using it. |
I use mac, linux and windows. I program primary for windows (because of it's popularity, not because I like it). I know what objective C is, so shut up. The topic should then be objective C++, not object C. That's what meant.
|
Quote:
And please be kind to people in the forum if you want them to be kind to you. Quote:
And the reason that I asked you "Are you sure you are using OS X (as your profile says)?" is to verify that you are using OS X and NOT OS 9 (which didn't have ObjC so it would be natural to confuse my first post). I suggest you read the 'How to Post' threads in this forum. Do not insult other people, especially if they have not insulted you. PS: If you wanted to talk about ObjC - ObjC++, why did you recommend me a windows-only function that wouldn't work with it? |
So what? I don't program in Objective C. And Mac is a piece of crap, BTW. I don't like the API in mac.
|
How ignorant of you(Dragon_Master). Not every one is going to use microsoft API because it is crap :rolleyes:
|
Quote:
Quote:
You know What Soul I have to say never heard of Objective C so I was confused at first, but seeing that it seems to be more of a MAC X thing that could explain it (I only have OS 8.6). Could you give a link of a good tutorial or references for me. You've spiked my interest. |
| All times are GMT -5. The time now is 8:05 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC