Lesson 2 Flashcards
objects
self-contained data structures that consist of properties, methods, and events. Properties specify the data represented by an object (adjective), methods specify an object’s behavior (actions or verbs), and events provide communication between objects.
encapsulation
Hiding the complexity of code inside something.
class (context of object oriented programming)
a class is like the template from which individual objects are created.
another name for object:
instance of a class
method
code blocks containing a series of statements
constructors
used to initialize the data members of the object.
How are objects created?
From the templates defined by classes.
What is the use of properties?
Allow you to access class data in a safe and flexible way.
access modifier
specifies what region of the code will have access to a field.
method’s signature
a method’s name, its parameter list, and the order of data types of the parameters. A method’s signature must be unique within a class.
default constructor
a constructor that takes no arguments
What is the method line format?
access level - return type - method name - parameters in parentheses - followed by a block of code in curly braces.
What are properties?
class members that can be accessed like data fields, but contain code like a method.
types of accessors:
get - used to return the property value.
set - used to assign a new value to the property.
When defining properties, a missing set accessor causes what?
You don’t provide a way to set the value of the property, and it becomes read-only as a result.