click below
click below
Normal Size Small Size show me how
csc 211
ALL review topics
Question | Answer |
---|---|
OOP and procedural programming | A class is basically a structure with member functions as well as member data. Classes are central to the programming methodology known as object-oriented programming. |
OOP CLASS | A class is a type that is similar to a structure type, but a class type normally has member functions as well as member variables. |
OOP CLASS TYPE OBJECT | The value of a variable of a class type is called an object (therefore, when speaking loosely, a variable of a class type is also often called an object). An object has both data members and function members. |
PROCEDURAL ABSTRACTION | means that your function should be written so that it can be used like a black box. This means that the programmer who uses the function should not need to look at the body of the function definition to see how the function works. |
Block scope | s some C++ code enclosed in braces. The variables declared in a block are local to the block, and so the variable names can be used outside the block for something else (such as being reused as the names for different variables). |
PARAMETER | Many people use the term parameter for both what we call formal parameters and what we call arguments. |
example parameter | int sum(int a,int b){ return a+b; } int a=sum(1,2); |
evaluating expressions | para comes first, ++ -- comes 2nd, * / comes 3rd and +- comes last. int = only put first value before decimal place double= put first and second value and round |
overloading by return | double mpg(double miles, double gallons) //Returns miles per gallon. { return (miles / gallons); } cout << mpg(45, 2) << " miles per gallon"; Savitch, Walter (2015-04-15). Absolute C++ (Page 168). Pearson Education. Kindle Edition. |
overloading bycall reference | PIZZA ARITHMATIC |
boolean | is an expression that results in a boolean value, that is, in a value of either true or false. |
precedence rules for boolean | Anything inside parentheses is done first. Arithmetic is done before equality and inequality tests. Logical operations are done after equality and inequality tests."Not" (!) is done before "and" (&&) "And" (&&) is done before "or" (||). Assign=last |
overloading by different value | use the void function in int main and anything not given value wise will be = to the above values given at the end. |
Call by value parameter | is like a blank a place holder to fill in the actual values that are going to be call by int main. local variable at the top. i.e. Law office |
call-by-reference parameter | must be marked in some way so that the compiler will know. The way that you indicate a call-by-reference parameter is to attach the ampersand sign, &, to the end of the type name in the formal parameter list. i.e. swap integers |
call by reference i.e. | void getInput(double& receiver) { cout << "Enter input number:\n"; cin >> receiver; } |
void swap values | cannot equal eachother through with same value, needs to be set first by an item not used-- temp = fnum. fnum=secnum; then equal to eachother than temp = secnum. |
call by value and call by reference | can be used via pg 158-159 void goodStuff(int& par1, int par2, double& par3); |