Classes & Objects Flashcards
What is a basic definition of a class (what is it used for)?
Basically, it is used to represent entites.
What does a member function do?
Used to add additional functionality to a class.
(Ex. Output values of a variable)
What does the “this” keyword do?
Very important keyword that is used to point to the current object.
What do class modifiers do?
Can be used to define the visibility or accessibility of the properties of a class or methods.
List and define the 3 main class modifiers.
Private - Properties/methods are only available to the class itself.
Protected - Properties/methods are only available to the class itself and subclasses derived from the class.
Public - Properties/methods are available to all classes.
What is a constructor?
Constructors are special methods in a class that are called when an object of the class is created. (A constructor has the name of the class).
What does the “static” keyword do?
This is used when assigning something and is used to define values that remain the same across all objects of a class.
(Ex. public static int Counter).