









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Problem: Sum up the elements of array A.
tively)
to
/** Insert X at location K in ARR, moving items
arr, k+1,ļøø ļø·ļø· ļøø to
arr.length-k-1ļøø ļø·ļø· ļøø
);
arr[k] = x; }
Basic Idea.
account
deposit
account
account
withdraw
account
Function-based
Account deposit withdraw balance: 1420
Exported methods
Exported field
Object-based
behaves sort of like a static method with hidden argument:
Java CS61A OOP class Foo ... (define-class (Foo args)... int x = ...; (instance-vars (x ...))
static int y = ...; (class-vars (y ...))
aFoo.f (...) (ask aFoo āf ...) aFoo.x (ask aFoo āx) new Foo (...) (instantiate Foo ...) this self