Types and Classes Flashcards
What are the two kinds of types in programming?
Built in User defined (for object oriented programming)
What is a class?
Defines a type and allows the creation of new types
What is an object?
An instance of a class
What is the construct to instantiate (create) an object?
Type ObjectIdentifier = new Type(); i.e Employee John = new Employee();
What is a method?
A method takes in parameters and does something with those values
What is a public vs private class or method?
Public is accessible by anywhere in the code
Private is only accessible by within the same class
What are the 3 attributes of classes?
Fields
Properties
Methods
What are properties of a class?
Inherently public; used to store values
What are fields of a class?
Inherently private, only can be accessed by methods of the class; used to store values
What is camelCase vs PascalCase?
camelCase uses lowercase first letter
PascalCase uses uppercase first letter
What syntax uses camelCase?
Fields, Variables, Parameters (myValue)
What syntax uses PascalCase?
Class, Constants, Properties (MyValue)
What is polymorphism?
Derived class overrides the inherited behaviour of the base class
How is polymorshpism implemented?
Create virtual method in parent(base) class and modify it in the derived class by specifying override
What is encapsulation?
Allows classes to hide their implementation through using access modifiers to deny access to members of a class