‹ Back to the paper
Question 1(vii)
1 mark
Computer ScienceISC 2024 Specimen Computer Science Paper 1Short answerMethods
Answer the following.
What is the relevance of the keyword static for a data member of a class
Answer
Answer
The 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.