Object Oriented Programming Practice Test: Class Members & Types — Flashcards | Object Oriented Programming | FatSkills

Object Oriented Programming Practice Test: Class Members & Types — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

Quiz on data members, member functions, local and nested class.
 

In object-oriented programming (OOP), there are two types of class members: instance members and static members.
Instance members are associated with a specific instance of a class, while static members are associated with the class itself.

Instance members: include variables (or fields) and methods. Variables store data specific to the instance, while methods define the behavior of the instance.
Static members: are shared by all instances of a class. They include static variables and static methods. Static variables are used to store data that is common to all instances of a class, while static methods are used to define behavior that is common to all instances of a class.

The greet() method is an instance method, as it is associated with a specific instance of the Person class.
The get_count() method is a static method, as it is associated with the class itself and not with any specific instance of the class.

Instance members and static members are important concepts in OOP, as they allow us to model real-world objects and their behavior in a way that is both efficient and flexible.

1 of 57 Ready
What is the term used to indicate the variable and constants of a class?
Data members
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password