CECS 282 Lecture 13
Overloading Methods and Constructors creating multiple methods (or
constructors) that use the same method name and perform similar tasks, but are
differentiated by their parameter lists.
Example Class creating a bank account class usin
CECS 282 Lecture 16 Pointers
A pointer is a variable that stores the address (a location in memory) of a value.
When a variable is created, the computer allocates a block of memory, which is not
currently being used, to store the value in. Dep
CECS 282 Lecture 15 Static Variables and Methods
Static refers to a variable or method that is not attached to a particular object, but attached
to the class itself.
Static Variable are made to keep information about the collective objects or on the
CECS 282 Lecture 14
Structures Structures are programmer defined data types. They are similar to
classes, except that they are smaller and usually do not have methods. Unlike classes,
whose data members default to private, a structures data members defaul
CECS 282 Lecture 11
Writing Classes and Their Methods
Classes are programmer defined data types. They encapsulate data and methods that
are common to the object. Classes are made up of instance variables that store
information about the object, and method
CECS 282 Lecture 10 C+ Arrays Continued
Arrays in Functions arrays are passed by reference, as such, when a function is
passed an array, if any of the elements values are changed, then the original array that
was passed is changed as well.
Arrays as Param
CECS 282 Lecture 9 C+
Arrays - An array is a collection of values of the same data type.
Declaring an array -
- or 
int array2 = cfw_1,2,3,4,5;
Both of these declarations create space for five integers in an array. T
CECS 282 Lecture 7
A function is a block of statements that are easily invoked by calling the functions name.
They are a convenient way to break up your program into smaller and more manageable
pieces. Every function is made up of a definition
CECS 282 Lecture 8 Functions Continued
Pass by Reference a function can take in parameters that are references to the
variables rather than copying over the values that are stored in them. That way the
variable that is passed can be changed directly.
CECS 282 Lecture 4 C+
If Statements and Random Numbers
Math Library Functions - http:/www.cplusplus.com/reference/clibrary/cmath/
Similar to the methods available to the String class, the Math library has many
mathematical functions available. In C+ you
CECS 282 Lecture 1 C+
Programming in C+
What is a Program?
A program is a set of instructions that is processed by the CPU. Most programs
involve: receiving input, processing data, and then outputting the results. Usually
a program is written to solve a
CECS 282 Lecture 6 Methods
Top-Down Design is the step-wise process of breaking down problems into smaller
tasks. Rather than diving straight into the code, plan out the components you will need to
accomplish your task. This process will save you time and
CECS 282 Lecture 2 C+
Declaring Variables and Input/Output
Variables A variable is a location in memory where a value can be stored. Each v
variable can only hold one value at a time. Declaring a variable requires:
dataType variableName = value;
After a v
CECS 282 Lecture 5 C+
Whenever we have a section of code that needs to be repeated we place it inside of a
loop. A while loop will repeat any code that is within its brackets, as long as the test
condition is true.
while ( test co
CECS 282 Lecture 3 C+
Strings in C+
Strings A string is a sequence of characters. Using strings requires that you include the
<string> library. Any string that you initialize as a literal needs to be enclosed in double
string fName = Joe;