Class Notes (810,512)
Canada (494,140)
Economics (470)
ECON 355 (1)

CPSC260 Review Notes.docx

5 Pages
Unlock Document

University of British Columbia
ECON 355
Steven Barnes

Inheritance: A class (called a derived class or a subclass) can reuse all the attributes and operations of another class (called a base class or parent class) Syntax errors: Violations of the grammar rules of the high-level language in which the program is written Run-time errors: Errors that occur during the program execution Logic errors: Errors in some aspect of the design – most often an algorithm on which the program unit is based &variable is the address of variable Pointer: A variable whose value is a memory address Type * pointerVariable; Or Type * pointerVariable = address; Size of an int: 4 bytes (32 bits) Typedef Mechanism: Create a new type by giving a new name to an existing type Typedef OldType Newtype; Dereferencing operator: accessing the contents of a memory location via a pointer *pointerVariable - Must ensure that pointer is not null or an undefined pointer will produce a fatal runtime error, or access garbage memory o Dangling pointers o Ptr++ increments address in Ptr o (*Ptr)++ increments contents of memory location at that address New Operation: requests memory from operating system during program execution New Type - Free store: unallocated memory locations - When New is called, makes request to OS to o Remove a block of memory from heap o Allocate that block to the executing program - If block of memory large enough to store value of specified Type, New returns starting address of the block of memory - If block of memory is not large enough to store value of specified Type, fatal error occurs, execution terminates - Creates anonymous variable which cannot be accessed like other variables - Must deference pointer o Can’t deference null or undefined point, will create error - Need # to enable standard new and delete operations in a program - If there is not enough memory to satisfy the request, New throws a bad_alloc_execption o Program will terminate, error message displayed Static Arrays: compiler determines how much memory will be allocated ElementType arrayName[CAPACITY]; - Typedef for arrays: typedef ElementType ArrayType[CAPACITY]; - Arrays are always passed by reference o Modifying an array parameter will also modify the corresponding argument Dynamic Arrays: memory allocation takes place during execution Eg. int* arrayPtr; arrayPtr = new int[6]; //allocates space for six integers Null Character: ‘\0’ = end of string mark Exceptions: - Requests for memory are made in a try block
More Less

Related notes for ECON 355

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.