How do you write "a class's constructor"? [duplicate]

That would be class' or class's, but I would rather change the sentence to avoid that altogether.

Also, as it's a specific pattern that is applied to a specific class, it would be more correct to refer to the pattern and the class instead of a pattern and a class:

In the singleton pattern, the constructor of the class needs to be private instead of public.

As the pattern is something that only is applied to a class, it can even be implied:

In the singleton pattern, the constructor needs to be private instead of public.


The Chicago Manual of Style, 14th edition says:

6.19: The possessive of singular nouns is formed by the addition of an apostrophe and an s [...]

There are a few exceptions listed later on, but they do not apply to a common noun ending in s (or ss).

Thus I say that

a class's constructor

is correct.


Both "a class' constructor" and "a class's constructor" are accepted as correct. More recent English use stylistic guides show preference for the "a class's constructor" use.