Basic Operators
+ addition
- subtraction
* multiplication
/ division
% modulus (remainder) (integer operations only)
Order of Operations
All expressions within a set of parentheses are evaluated first. If there are parentheses within parentheses (nested parentheses), the innermost expressions are evaluated first
The operations *, %, and / are evaluated next in order from left to right
The operations + and – are evaluated last from left to right
Boolean Operators – Using Boolean expressions will return “True” or “False”
== (is equal to)
< (is less than)
> (is greater than)
<= (is less than or equal to)
>= (is greater than or equal to)
! (not)
!= (is not equal to)
&& (and)
|| (or)
Order of Boolean Operators – Note: Normal operators have priority over Boolean operators
( )
!
*, /, %
+, -
<, <=, >, >=, ==, !=
&&
||
== and =
== means “is equal to”, while = assigns a value to a variable
Short Circuit Evaluation
If there is a compound Boolean expression with a &&, then if one expression returns “false,” then the entire expression is false
If there is a compound Boolean expression with a ||, then if one expression returns “true,” then the entire expression is tru
Boolean: expression; can be true(any value but 0) or false(0)
relational operator- used to compare data of same type
arithmetic op relational op
= = = is equal to
< < is less than
> > is greater than
≤ < = is less than or equal to
≥ > = is greater than or equal to
≠ ! = is not equal to
simple boolean expression – two numbers/variables compared with ONE relational operator; will return true or false
ex. – c = = c would return true; -5 >= 10 would return false…
arithmetic expressions can be used in boolean expressions; order of priority in evaluation:
expression priority
( ) 1
*, /, % 2
+, - 3
= =, <, >, < =, > =, ! = 4
logical operators – logical connective or negation (used with simple boolean expressions)
complete expression called compound Boolean expression
conjunction – AND && - returns true if both true
disjunction – OR | | - returns true if either one is true
negation – NOT ! – returns true if false; false if true
priority evaluation for logical ops: 1. ! 2. && 3. | |
overall priority of evaluation list for relational/ logical ops + arithmetic ops:
expression or operation priority (evaluate from:)
( ) inside to out
! left to right
*, /, % left to right
+, - left to right
<, <=, >, >=, = =, != left to right
&& left to right
| | left to right
short-circuit evaluation – a compound Boolean expression halts evaluation early and:
if connected by || returns true for first expression that is true
if connected by && returns false for first expression that is false
deMorgan’s law:
not (x and y) = (not x) or (not y)
not (x or y) = (not x) and (not y)
What is the Scope of an identifier?
It refers to the block, or area of code in which the identifier can be used.
/***************************************
const double PI = 3.14;
double circle(int radius)
{
double area;
area = PI*radius*radius;
return area;
}
main()
{
int r = 2;
int A;
A = circle(r);
}
*****************************************/
In this code:
The indentifier PI is not declared inside of a function, therefore, the scope of PI is the Program file block, which basically means is can be used everywhere in the code, including the function circle(int) and the main() function. This kind of identifier is called a global identifier.
The identifier area is declared inside of the subprogram circle(int), making it a local identifier. The identifiers r and A declared inside of main() are also local identifiers.
Local identifiers can only be accessed inside of the function in which it is declared, so the area can only be used in the subblock of circle(int). main() cannot use area in its statements. Furthermore, circle(int) cannot use r or A in its statements.
Examples:
You could use the statement: cout << PI, inside of main() to print 3.14, even though PI is not declared in main – because PI is known globally.
However, putting: cout << area, inside of main() would not work because area’s scope does not include the main() subblock. Area can only be used in circle(int).
Names of Identifiers:
Realize that two different functions can have identifiers declared inside their blocks with the same name. If the statement: double area, is put in main(), this area would be a different variable than the one in circle().
INPUT/OUTPUT STREAMS
-An input file stream is used to receive input from a file, and an output file stream is used to send output to a file. To access file stream operations, you must type #include <fstream.h> in your program.
-When declaring file streams, you must set them to either type ifstream(input file stream) or ofstream(output file stream):
-ifstream in_file;
-ofstream out_file;
-To open and close file streams:
-in_file.open(“myfile”);
-in_file.close();
-To detect errors in opening or closing files, a .fail function can be used. This function returns true if the program fails to open or close a file, and false otherwise.
- assert(! out_file.fail()); //this requires assert.h
-To read from an input file, the >> operator is used, and to write to an output file, the << operator is used. Whitespace characters are used as separators between data values.
-out_file<<variable<<” “<<endl;
-in_file>>variable;
//This reads in data from the input file and stores it in variable
-The .eof function is used to detect the end of a file. It returns true if there is no more data to be read from the input file, and false otherwise.
-in_file>>data; //priming input statement- this is used to make //sure the program runs correctly even if the //file has no data
while (! in_file.eof())
{
process(data);
in_file>>data;
}
-A line of text can be read from an input file by using the getline function, as shown. You need to include apstring.cpp in your program for this to work.
-getline(in_file,data);
-For character input and output, get and put are used in place of >> and << to read data to input files and write data to output files. Get and put deal with one character at a time, and this includes whitespace characters.
-in_file.get(ch)
-out_file.put(ch)
Object-Oriented Programming (OOP)
What is an Object?
An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life.
Large software systems should be constructed from smaller software components called objects.
Objects are like building blocks, they can be pulled out of a box and put together in different ways to construct different applications.
No need to change existing code or writing new code, software maintenance involves plugging objects into a system or unplugging them from a system.
Easier to develop a program.
Object-oriented design is a methodology that uses small, reusable components to construct large software system.
Object-oriented design method that models the characteristics of abstract or real objects using classes and objects.
Objects are modeled after real-world objects in that they too have state and behavior. A software object maintains its state in one or more variables. Objects also implements its behavior with methods.
Public:
Can be accessed anywhere the class is present
Private:
Can only be accessed by the .H file and
the .CPP implementation file for the given class
Assessors:
Public by definition, returns the value of a private variable
Modifier:
Public by definition, allows an external
way to modify private variables
Those are the bare basics.
Step 1:
Class NAME
Step 2:
{
Public:
Private:
};
Step 3:
Fill them in (privates and publics)
class my_class_of_songs
{
public:
my_class_of_songs() ; // constructor, needed for declaration of variables
//accessor
apstring get_names() const; // accessor, returns the apstring which holds the value of the // name
// modifier
void set_names(); //modifier that sets the private variable which has the value of the name
private:
apstring name; // has a value for every different variable of my_class_of_songs
};
example of implementation:
my_class_of_songs::my_class_of_songs(){}
// empty because you are not setting any values, just creating a variable of type // my_class_of_songs
apstring my_class_of_songs::get_names() const{
return name;
}
// returns the value of the private variable name because the private is block, you have to //make a modifier
//its const to keep the value safe
void my_class_of_songs::set_names(){
cout << “Please enter the name of the song: “;
getline(cin,name);
}
Nested if statement
A selection statement used within another selection statement
It can be any combination of if or if…else statements
Example:
if score >= 50
if score > 69
cout << "Your progress is satisfactory.";
else
cout << "Your progress is unsatisfactory.";
else
cout << "You are currently failing.";
If the score is greater than or equal to 50, this code will either display satisfactory or unsatisfactory. Otherwise, it will say that you are failing.
Extended if statement
Nested selection where additional if…else statements are used in the else option
They take the following structure:
if (<condition 1>)
//action 1 here
else if(<condition 2>)
//action 2 here
else if(<condition 3>)
//action 3 here
else
//action 4 here
The example under nested if statements can be written as a series of extended if statements:
if (score > 69)
cout << "Your progress is satisfactory.";
if ((score <= 69) && (score >=50))
cout << "Your progress is unsatisfactory.";
if (score < 50)
cout << "You are currently failing.";
switch statements
An alternative method of handling multiple selection
It can be used when several options depend on the value of a single variable or expression
General structure for switch statement:
Switch(<selector>)
{
case <label 1>: <statements 1>
break;
case <label 2>: <statements 2>
break;
. .
case <label n>: <statements n>
break;
default: <statements>
}
The words switch, case, break, and default are reserved
The selector can be any variable expression that has ordinal data types
If a break statement occurs within these statements, then control is transferred to the first program statement following the entire switch statement
If certain values require no action, the program will finish executing the switch statement by running the default as the last option
Both the break statement and default statement are optional
This is an example of what a switch statement might look like:
switch (age)
{
case 30: cout << "Happy 30th birthday";
break;
case 20: cout << "Happy 20th birthday";
break;
case 10: cout << "Happy 10th birthday";
break;
default: cout << "There is no case for " << age << endl;
}
AP Vector
A vector is a one dimensional array that provides range checking and can be resized.
Basically, any operation that can be used on an array can be used on the vector as well.
Attributes of a vector:
mySize-vector’s capacity
myList-vector’s data elements
itemType-vector’s element type
class template is a kind of class that allows its component types to be specified as parameters:
ex. Apvector<vector type> (name).
pointers are variables that can hold the address of a memory location, just ‘pointing’ to the location rather than being the location.
Can use the notation:
:mySize(0), myList(0) to set the vectors to zero rather than,
mysize=0;myList=0;
set a memory location by doing: <pointer value>=new<item type>[<number of items>]
destuctor is a function that returns dymanic memory for an object of the system, pretty much destroys the memory location:
ex. delete[] myList;
declaration of index: <name>[number of locations]
AP Matrix
a matrix is basically a vector, but with two dimensions
attributes of matrix:
myRow-gets the number of rows
myCols-get number of columns
myMatrix-data elements
itemType-matrix element type
declaration of index: <name>[number of rows][number of columns]
Algorithm: A finite sequence of effective statements that, when applied to a problem, will solve it.
Programming language: A formal language that computer scientists use to give instructions to a computer.
Data: The particular characters that are used to represent information in a form suitable for storage, processing, and communication.
Mainframe: A large computer typically used by major companies and universities.
Minicomputer: A small version of a mainframe computer. It is usually used by several people at once.
Microcomputer: A computer capable of fitting on a laptop or desktop, generally used by one person at a time.
Workstation: A powerful desktop computer that uses microprocessor technology.
Network: A group of computers that are linked to share resources.
Client/server relationship: A means of describing the organization of computing resources in which one resource provides a service to another resource.
Hardware: The physical computing machine and its support devices.
Software: Programs that make the machine do something, such as word processing, database management, or games.
Program: A ser of instructions that tells the machine what to do.
Main unit: A computer’s main unit contains the CPU and the main memory; it is hooked up to an input and an output device.
Central processing unit (CPU): A major hardware component that consists of the arithmetic/logic unit and the control unit.
Main primary memory (aka random access memory): Memory contained in the computer.
Arithmetic/logic unit: The part of the CPU that performs arithmetic operations and evaluates expressions.
Control unit: The part of the central processing unit that controls the operation of the rest of the computer.
Execute: To carry out the instructions of a program.
Binary digit (aka bit): A digit, either 0 or 1, in the binary number system. Program instructions are stored in memory using a sequence of binary digits. Binary digits are called bits.
Input device: A device that provides information to the computer. Typical devices are keyboards, disk drives, card readers, and tape drives.
Output device: A device that allows you to see the results of a program. Typically it is a monitor or a printer.
Secondary memory device: An auxiliary device for memory, usually a disk or magnetic tape.
I/O device: Any devices used for input or output.
Bus: A group of wires imprinted on a circuit board to facilitate communication between components of a computer.
Modem: A device that connects a computer to a telephone system to transmit data.
System software: The programs that allow users to write and execute other programs, including operating systems such as DOS.
Application software: Programs designed for a specific use.
Operating system: A large program that allows the user to communicate with the hardware and perform various management tasks.
Machine language: The language used directly by the computer in all it’s calculations and processing.
Assembly language (aka low-level language): A computer language that allows words and symbols to be used in an unsophisticated manner to accomplish simple tasks.
High-level language: Any programming language that uses words and symbols that make it relatively easy to write a program.
Compiler: A computer program that automatically converts instructions in a high-level language to machine language.
Source program: A program
written by a programmer.
Object program (aka object code): The machine code version of
the source program.
Effective statement: A clear, unambiguous instruction that can be carried out.
Top-down design: A methodology for solving a problem whereby you first state the problem and then repeatedly subdivide the main task into subtasks until each remaining subtask is easily solved.
Stepwise refinement: The process of repeatedly subdividing tasks into subtasks until each subtask is easily accomplished.
Module: An independent unit that is part of a larger development. Can be a function or a class.
Structure chart: A graphic method of indicating the relationship between modules when designing the solution to a problem.
Module specifications: A description of data received, information returned, and the task preformed by a function.
Pseudocode: A stylized half-English, half-code language written in English, but suggesting C++ code.
Software engineering: The process of developing and maintaining large software systems.
Software system life cycle: The process of development, maintenance, and demise of a software system.
Object-oriented design: A
methodology that uses small, reusable components to construct large
software systems.
Reserved words: Words that have predefined meanings that
cannot be changed.
Library identifiers: Words defined in standard C++ libraries.
Programmer supplied identifiers: Words defined by the programmer.
Keywords: Either reserved words or library identifiers.
Syntax: The formal rules governing construction of valid statements.
Preprocessor directives: Statements that tell the C++ preprocessor to perform such tasks as combining source program files prior to compilation.
Constant and type definition section:An area of a C++ program where constant and type definitions are placed, usually near the beginning of the text.
Main program heading: A syntactic form that marks the beginning of the main program.
Main block: The main part of a program.
Declaration section: The section used to declare variables that are necessary to the program.
Statement section: An area of a C++ program where the executable statements are placed.
Executable statement: The basic unit of grammar in C++ consisting of valid identifiers, standard identifiers, reserved words, numbers, and/or characters, together with appropriate punctuation.
Comment: A non-executable statement used to make a program more readable.
Data type: A formal description of the set of values a variable can have.
Fixed-point form: A method of writing decimal numbers in which the decimal is placed where it belongs in the number.
Floating-point form: A method for writing numbers in scientific notation to accommodate numbers that may have very large or very small values.
String: A data type used to represent a word or line of text.
String constant: A word or a line of text enclosed in double quotes.
Standard output stream: An object to which a program sends data for output to a device, normally the terminal screen.
Format manipulator: A symbol that instructs the computer to display output in a specified format, such as right justified.
Test program: A short program written to provide an answer to a specific question.
Pixel: A picture element or dot of color used to display images on a terminal screen.
Coordinate system: A grid in which a point in space or a pixel on a computer screen can be located.
Word: a unit of memory consisting of one or more bytes. Words can be addressed.
Integer overflow: When an integer value is too large to be stored in the computer’s memory.
Round-off error: when a portion of a real number is lost because of the way it is stored in the computer’s memory.
Underflow: When a value is too small to be represented by the computer, the value will be automatically replaced by zero.
Ex: 1.23 * 10^-20 = .0000000000000000000123 which will be stored as zero.
Representational error: When the precision of data is reduced because of the order in which the operations are performed.
Ex: (-42.5 + 45.6) + .215 = .315 -45 + 45.6 yields .1. Then, .1 + .215 yields .315.
-45.5 + (45.6 + .215) = .3 45.6 + .215 yields 45.815. Since the hypothetical computer only yields three digits of accuracy, this result will be stored as 45.8. Then, –45.5 + 45.8 yields .3.
Cancellation Error: When data are lost because of differences in the precision of the operands.
Ex: 2 + .0005 This value should be 2.0005, but stored to only three digits of accuracy, the result would be 2.00. In effect, the smaller of the two numbers is canceled from the expression.
Mixed-mode expression: An expression containing data of different types; the resulting value of the expression will be of either type, depending on the rules for evaluating them.
Ex: In an expression involving both int and double data types, the value will be of type double.
Memory location: a storage cell that can be accessed by address.
Variable: If the contents of the memory location are to be changed during a program, it is called a variable.
Constant: If the contents of the memory location can not be changed during a program, it is called a constant.
Assignment statement: putting values into memory locations.
Ex: <variable name> = <value>; sum = 30; letter = ‘C’;
Or <variable name> = <expression>;
Compound assignment: An assignment operation that performs an operation before storing the result in a variable.
Ex: x = x + y. This expression adds the value of x and the value of y, and then stores the sum in x.
Self-documenting code: Code that is written using descriptive identifiers.
Extractor: the standard input operator >>.
Ex: cin >> length;
Inserter: the standard output operator <<.
Ex: cout << length;
Collating sequence: The order sequence for a character set used by a machine.
Ex: ASCII
Character set: the list of characters available for data and program statements.
Concatenation: When the contents of one data structure are placed after another data structure.
Ex: apstring first, second, third;
first = “Hi”;
second = “ there”;
third = first + second;
cout << third;
This displays Hi there on the screen.
Class: A description of the attributes and behavior of a set of objects.
Member function: functions defined for a class.
Ex: word.length( );
<variable name>. <member function name>( );
Seed: An initial value used by a random number generator.
Type promotion: When the computer converts a less inclusive data type such as int, to more inclusive data type, such as double.
Ordinal data type: A data type ordered in some association with integers.
Ex: Using ASCII, the ordinal of a capital a (‘A’) is 65.
Type cast: an operation that converts the type of a data object.
Ex: <type name> (<expression>)
int (3.14);
25. Explicit type conversion: the use of an operation to convert the type of a data object.
Subprogram: a program within a program.
Abstract data type: A set of objects with a defined set of properties and operations for processing the objects.
Modularity: The organization of the program into independent units.
Bottom-up testing: the independent testing of modules.
Structured programming: programming where the emphasis is placed on the flow of control between independent modules. Parallels a top-down design.
Structured design: organizing communication between modules.
User-defined function: a function introduced and defined by the programmer.
Function declaration: consists of the function’s name, number and kind of arguments, and the type of value returned.
Ex: double pow(double base, double exponent);
Function implementation: a complete, brief program that produces some effects if certain assumptions about the arguments to the function are satisfied.
Function heading: looks like the function declaration only the semicolon following the right parenthesis is omitted.
Formal parameter: a name that is declared and used in a function declaration that is replaced by an actual parameter when the function is called.
Actual parameter: a variable in a function call that is passed to that function.
Locally declared data: Data declared with a block, usually the block of the main program or a function.
Stub programming: Using incomplete functions to test data transmission among them.
Main driver: the main program when subprograms are used to accomplish specific tasks.
Void function: A function that returns no value.
Parameter mode: the way that a parameter is passed, such as by value or reference.
Value parameter: when values are passed only from the caller to a function.
Reference parameter: a formal parameter that requires the address of the actual parameter to be passed to a subprogram. The value can be changed within the subprogram.
<type name>&<formal parameter name>
Alias: When two or more identifiers in program refer to the same memory location. Reference parameters in the function heading are merely aliases for actual variables used by the caller.
Constant reference: a reference parameter that will not change in a function.
Ex. const <type name> & <parameter name>
apstring get_string (const apstring &prompt);
Cohesive subprogram: a subprogram that performs a single task.
Functional abstraction: considering only what a function is to do rather than details of the function.
Precondition: a statement that is true before a certain action is performed.
Postcondition: a statement of what is true after a certain action is taken.
Information hiding: When the user does not know the details of how a module is implemented and the implementer does not know how the module is used.
Interface: a statement of how communication occurs between the user of a subprogram and its implementer.
Block: the global text of the program file.
Subblock: a block structure for a subprogram.
Scope of identifier: the area of the program text in which an identifier can be used.
Global identifier: can be used in the main program and all subprograms.
Local identifier: restricted to use within a subblock of a program.
Side effect: a change in a non-local variable that is the result of some action taken in a program.
Manifest interface: When the function is called, the reader of the code can clearly tell that a side effect will occur in the function, a what the side effect will be.
Library header file: source code usually with a .h suffix, containing data and function declarations.
Library implementation file: source code with a .cpp suffix containing function implementations.
Chapter 5
Selection statement- Selection statements are statements that permit the computer to make decisions. An if statement is a a type of selection statement.
Control structures- Selection statements are a form of control structures because it allows the programmer to control the flow of programming statements.
Boolean- is an expression that determines whether a value is true or false.
Type definition- type definitions are used to create new type names for declaring variables, function parameters, and function returns of the values.
Relational operator- These are operators used to compare data of the same type (ie. ==, <,>,<=,>=,!=0
Simple Boolean expression- is an expression that uses relational operators to compare two values, returning either true or false. (ie. 7 == 7)
Logical operator- && (meaning and), || (meaning or), ! (meaning not)
Conjunction- Is a boolean expression connected by the && symbol. It returns false if one expression is false or true if both of the expressions are true.
Disjunction- Is a boolean expression connected by the || symbol. It returns true if one expression is true or false if both expressions are false.
Negation- Is boolean expression using the ! symbol. It returns false if the expression is true or true if the expression is false.
Compound Boolean Expression- is an expression when logical operators are used with relational operators.
(ie. (4.2 >= 5.0)
&& (8 == (3+5)) )
Short circuit evaluation- this is a process that impedes an
evaluation if the expression is true, in the case of ||, or false in
the case of &&.
Compound statement- it is a statement that uses {} symbols to
combine several statements together.
Statement block- it is a group of statements that can be treated
as one statement.
Nested if statement- it an if statement within another if
statement.
Extended if statement- a nested if statement with the addition of if else.
Assertion- Special comments that state what is expected to happen after a condition.
Program proof- an analysis of a program that attempts to verify the correctness of program results.
Chapter 6
Pretest loop- A loop where the control condition is tested befor the loop is executed. (ie. For loop, while loop)
Pretest condition- a condition tested at the top of the loop that controls whether the loop is executed.
Post-test loop- a loop where the loop is tested after it is executed. (ie. do while loop)
Fixed repetition loop- a loop used when the number of repetitions are known. (ie. for loop)
Variable condition loop- a loop used when the numbers of repetitions are unknown. (ie. whilw loop, do while loop)
Accumulator- a variable used in
order to summing the successive values of some other variable.
(ie. for (lvc = 1; lvc <=100; ++lvc)
sum= sum+lvc;
Decrement- in a for loop the control variable is decreased by one.
Infinite loop- a loop where the
control condition does not let the loop terminate.
(ie. a = 1;
while (a > 0)
{
num = 5;
count << num << endl;
}
cout << a ;
Sentinel value- a value that allows a loop to terminate when entered.
Counter- A variable used to count the number of times a process is needed to complete a task.
Data validation- The process of examining data before its use on a program.
Loop verification- the process of guaranteeing that a loop performs its intended task
Input assertion- a precondition for a loop
Output assertion- a postcondition for a loop
Loop invariant- is an assertion that expresses a relationship between variables that remain constant throughout the loop.
Loop variant- An assertion that changes from first and final execution of a loop.
Nested loop- A loop within another loop. (ie. for (k=1; k<=;==k)
For (j=1;j<=3;++j)
Cout<<( k+j) << endl;
File: A data structure that resides on a secondary storage medium.
Stream: A channel in which data are passed from sender to receiver.
Output Stream: A channel for sending output data.
Input Stream: A channel for receiving input data.
Input File Stream: An input stream that is connected to a file.
Output File Stream: An output stream that is connected to a file.
Abstract: Simplified or partial; hiding detail.
Portable: Able to be transferred to different applications or computers without changes.
Priming Input Statement: An input statement that must be executed before a loop control is tested.
Sequential Search: The process of searching a list by examining the first component and then examining successive components in the order in which they occur.
Buffered File Input: the input of large blocks of data from a file.
Buffer: A block of memory into which data are placed for transmission to a program.
Chapter 8
Array: A data structure whose elements are accessed by means of index positions.
Index: The relative position of the components of an array.
Range Bound Error: The situation that occurs when an attempt is made to use an array index value that is less than 0 or greater than or equal to the size of the array.
Physical Size: The number of memory units available for storing data items in a data structure.
Logical Size: The number of data items actually available in a data structure at a given time.
Selection Sort: A sorting algorithm that sorts the components of an array in either ascending order or descending order. This process puts the smallest or largest element in the top position and repeats the process on the remaining array components.
One-Dimensional Array: An array in which each data item is accessed by specifying a single index.
Two-Dimensional Array: An array in which each data item is accessed by specifying a pair of indices.
Struct – a data structure that can have components of different data types.
Classes – a description of the attributes and behavior of a set of computational objects
Procedural Programming – a style of programming that decomposes a program into a set of functions or procedures.
Object-oriented Programming – a style of programming that decomposes a program into a set of communicating objects.
Member – a component of a struct or class.
When struct variables are declared, the computer allocates memory for all of the components in both structs. These components are called fields, or members of the struct.
Selector – the operator (.) used to access a member of a struct or class.
A selector is formed by placing a period (.) between a struct variable and the name of the member.
Data Abstraction – the separation between the conceptual definition of a data structure and its eventual implementation.
Abstract Data Type (ADT) – consists of a set of values, a defined set of properties of these values, and a set of operations for processing the values.
Encapsulation – the process of hiding and restricting access to the implementation details of a data structure.
Instances – a computational object bearing the attributes and behavior specified by a class.
Synonym: object
Attribute – a property that a computational object models, such as the balance in a bank account.
Behavior – the set of actions that a class of objects supports.
The first step in developing a new class to solve a problem is to draw up a list of user requirements. These state the attributes and behavior that users expect the class to have.
Formal Specifications – the set of preconditions and post conditions of a function.
Class Declaration Section – an area of a program used to declare the data members and member functions of a class.
Class Implementation Section – an area of a program used tom implement the member functions of a class.
Data Member – a data object within a class declaration module.
Public Member – a data member or member function that is accessible to any program component that uses the class.
Public members can be referenced by any module that includes the class library.
Private Member – a data member of member function that is accessible only within the scope of a class declaration.
Private members cannot be referenced directly by the users of the class.
Constructor – creates objects of the class.
Accessor – returns the values of the attributes.
Modifiers – modify the values of the attributes.
Default Constructor – a member function that creates and provides reasonable initial values for the data within an object.
Copy Constructor – a member function defined by the programmer and automatically used by the computer to copy the value of objects when they are passed by values to functions.
Const Function – a member function that does not allow changes to the attributes of an abject.
Polymorphism – the property of one operator symbol or function identifier having many meanings.
Overloading – to reuse any built-in operator (or function name, also) to designate and operation on new data types.
1-Value – a computational object capable of being the target of the assignment statement.
A.k.a.TRUE
Software Reuse – the process of building and maintaining software systems out of existing software components.
Server - a computational object that provides service to another computational object.
Client – a computational object that receives a service from another computational object.
Sender - a computational object that requests a service from another computational object.
Receiver – a computational object to which a request is sent for a service.
Base Class – the class form which a derived class inherits attributes and behaviors.
Derived Class – a class that inherits attributes and behavior from other classes.
Free Function – a function not declared within the scope of a class declaration module.
Access Specifier – a symbol that specifies the kind of access that clients have to a server’s data members and member functions.
Protected Member – visible to a derived class, but not visible to any other part of a program.
Vector – a one-dimensional array that provides range checking and can be resized.
Fill Value – a value that is used to initialize every component in a data structure.
Class Template – a kind of class that allows its components types to be specified as parameters.
Pointer Variable – a variable that contains the address of a memory location.
Used we cannot predict the size of a data structure.
Dynamic Memory – memory allocated under program control and accessed by means of pointers.
This is the memory the programmer can request when it is needed by an application.
Destructor – a member function the returns dynamic memory for an object to the system.
Substring – a string that represents a segment of another string.
Ordered Collection – provides subscript access to just those data locations where elements have been stored.
Sorted Collection – a data structure that behaves like an ordered collection, but the data items are maintained in ascending order.
Access Adjustment – a method of changing the access mode of an inherited member from within a derived class.
For Example: a derived class may inherit all members from a base class in protected mode, and then make some members public by means of access adjustments.
Contained Class – a class that is used to define a data member of another class.
Matrix - a two-dimensional array that provides range checking and can be resized.