Take the 2-minute tour ×

Objective-C and C++ belong to the C family, so in terms of "static", there are static variables, static functions, static classes etc.

Static has static storage, lifecycle, scope.

Here is the question:

  • What are the big differences in the meaning of "static" in C++ and Objective C?
share|improve this question
Object C? Do you mean Objective-C? –  Mark Byers Dec 30 '10 at 3:10
static has enough different meaning in C++ alone you don't need to bring objective-C into it. –  Loki Astari Dec 30 '10 at 4:57

2 Answers 2

up vote 3 down vote accepted

static has the exact same meaning in Objective-C that it would have in C. It does not mean the same thing as in C++. In C++, static is additionally used to declare and define class methods (methods which can only be called on the class itself) and variables, but Objective-C distinguishes class and instance methods with different syntax:

+ (void)classMethod;
- (void)instanceMethod;

and does not support class variables.

share|improve this answer

static in Objective-C is identical to its plain C counterpart (specifying the variable linkage). While C++ supports this usage of static, it extends the meaning of the static keyword to declaring class methods as well.

share|improve this answer

Your Answer


