static-member

Object retain behavior of Objective-C class methods

What's the best practice for retaining and releasing objects passed to class methods? For instance, if you have a "class variable" declared like so: static NSString *_myString = nil ...is the right thing to do this: + (void)myClassMethod:(NSString *)param { _myString = param; } ... which has the drawback that the caller needs ...

Public (static) property in jQuery plugin

I've a small jQuery plugin that I use for form AJAX validation. There is a callback that alerts the calling script of every "stage" in the validation/submission process. Some snippets: (function ($) { $.fn.formHelper = function (options) { // settings options etc var stage = { Start: 1, ErrorReceived: 2, AllErrorsRe...

vc++ - static member is showing error

I am using vc++(2010). I am trying to create a class for server side socket. Here is the header file #include<winsock.h> #include<string> #include<iostream> using namespace std; class AcceptSocket { // static SOCKET s; protected: SOCKET acceptSocket; public: AcceptSocket(){}; void setSocket(SOCKET socket); static void EstablishC...

Initializing static pointer in templated class.

This is difficult for me to formulate in a Google query (at least one that gives me what I'm looking for) so I've had some trouble finding an answer. I'm sure I'm not the first to ask though. Consider a class like so: template < class T > class MyClass { private: static T staticObject; static T * staticPointerObject; }; ... te...

Trying to use static methods/members, need some help

Hello, I've been spoilt with c# coding the last few years and now I'm back onto c++ and finding that I'm having trouble with stuff that is supposed to be simple. I'm using a third party library for gamedev called DarkGDK (any commands which are prefixed with db), however DGDK isn't the problem. Heres my code: System.h #pragma once #...