‹ Back to the paper
What is the relevance of the keyword static for a data member of a class
Answer
Answer
AIThe keyword `static`, when used with a data member of a class, makes it a class variable instead of an instance variable: only a single copy of that data member is created and it is shared by all objects of the class (rather than a separate copy for each object). Its value persists across all objects and can be accessed directly using the class name, even without creating an object.
From ISC 2024 Specimen Computer Science Paper 1, question 1(vii).