object oriented programming in c++ - singleton

how do i make only 1 object creation of any class?

It's known as the Singleton design pattern. There are many tutorials for it, e.g. one here.

Check out the Singleton Pattern: http://sourcemaking.com/design_patterns/singleton
EDIT: Updated link from C# to C++

Related

Is there any equivalent of Java generics in IOS?

In Java you can use generics to force the use of objects of a certain class.
Example: ArrayList forces the ArrayList to have instances of TestObject in it. This provides a strict list of objects.
I know you can also do this in Actionscript with the Vector class.
Is there any way to do this in Objective-C?
No, there is no equivalent. The only thing even remotely close is creating your own collection that, at runtime, enforces the class you've picked, but Java generics is a compile-time thing and there's no equivalent in obj-c.
From iOS 9 there are generics.
I can't find the reference to docs but this article contains a couple of words about the topic:
http://iosdevtips.co/post/121053658888/wwdc-ios-9-swift-2-notes
UPDATE:
There is also a new related feature called KindOf Types.
You can read about this one at the end of the article:
https://medium.com/the-traveled-ios-developers-guide/objective-c-in-2015-3cb7dab3690c

What's the point of creating classes at runtime in Objective-C?

I've recently reread the interesting tutorial from Mike Ash about How to create classes at Objective-C Runtime
I has been a long time I am wondering where to apply this powerful feature of the language. I always see an overkill solution to most of the ideas that come to my mind, and I eventually proceed with NSDictionary. What are your cases of use of creating classes at runtime? The only one I see is an Obj-C interpreter... More ideas?
There's some possible options I see, when someone need to create class in runtime
To hide information about it (It won't help in most cases, but... you can)
To perform multiple-inheritance (If you really need it :)
Using your own language(i.e. some XML-like), that can be interpreted by your program, writted in Obj-C (Something like NSProxy, but even better.)
Creating some Dynamic-Class that can change it's behavior in runtime
In general.. There is some possible usages of this. But in real world, in default service applications there's no need to do this, actually:)
It could be used for example along Core Data or any API related to a database to create new classes of objects unknown at compilation time. However, I doubt this is used often, it's mostly the mechanism the system uses itself when it runs a program...
KVO, in the Cocoa frameworks, is implemented by dynamically creating "notifying" versions of your classes. See http://www.mikeash.com/pyblog/friday-qa-2009-01-23.html

access a variable of another class via a property

I have two classes,In classA I create a variable that I need to use in classB ,
should i use property ?
is there anyone to explain me easier ,how to set StringValue of variable in one class to the textfield of another class?
thanks
Yes, and yes:
http://www.cocoacast.com/?q=node/103
The simple answer is Yes, use properties, that is what they are for: a simple way of exposing the state of an object to other objects.
The longer answer is that Objective-C 2.0 properties are just a wrapper around the concept of Key-Value-Coding and Key-Value-Observing (KVC/KVO).
It is well worth reading the documentation for these as the concept is fundamental to the way that Cocoa works and understanding them early on in your learning process will save you a lot of trouble in the future.
And, since you will be passing object references around I might as well add a link to the Memory Management Programming Guide which will help you correctly apply the proper memory management attributes to your #property declarations.

What is a delegate?

I was coding some stuff on objetive c.. but I still dont get it, I dont know/understand what a delegate is at all.
Maybe cuz my main programming language is C++ and Java... dont know.
I searched the web looking for an ENGLISH explanation, but, seems like I dont speak english :)
A delegate is an instance of an object that implements a bunch of what C programmers call callbacks, but in an object-oriented way. Like most new concepts, it is really just an old convention renamed and obfuscated.
There are some nice examples here on wikipedia.
In Objective-C, a delegate is an object that conforms to a specific protocol, that another object can rely on for specific functionality. It's a different concept to delegation in lots of other languages, and it can get confusing because the terminology is the same.
Here's an article I found rather useful when I started programming in Objective-C:
http://developer.apple.com/mac/library/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html

Is there a name meaning "not a singleton"?

Is there a name meaning "not a singleton"?
Castle Windsor uses the term "transient" to describe all non-Singleton objects.
I personally prefer the term "non-Singleton" though.
Yes, there is a Multiton pattern, but it means something very specific. It's not simply everything that's not a Singleton.
Prototype.
It is used as a scope in Spring framework to identify dependency which will always be new instance when injected.
When someone asks me if a class is a Singleton (and it isn't), I just say no, it's a regular class.
Multi-Instance ?
http://elegantcode.com/2008/04/17/the-opposite-of-a-singleton/
Actually, there is a variant on the Singleton called Multiton or Multiplton or something like that. Rather than having one instance, you have n instances where n is a specific value. I'm not sure if the Gang of Four describe this application in their book, but I learned about it in my Software Engineering 361 class.
But if you have an unconstrained number of instances, I don't think there is a name for it.
Simply, a 'Single Instance of a Class.'
This is an old post, but if someone still comes across then a better word is "multiplex" over "transient". IMHO
Definition:
noun:
a system or signal involving simultaneous transmission of several messages along a single channel of communication.
There is a related thread about this over at English Language & Usage. Looking through the various suggestions posted there, I think the best one is
replicant
I've adopted this term in the naming of methods and the wording of comments in a little PHP Reflection factory I've built.
How about the word "Instanced"