- Feb 8, 2004
- 12,604
- 15
- 81
With object oriented stuff you can look at the code for individual classes that make up the objects, with procedural... is it just like one massive page full of code that you scroll down or what?
public class weebaws
{
Random aRandomGenerator = new Random();
int aNumber = aRandomGenerator.nextInt();
}
int aNumber = nextInt();
public int nextInt()
{
//all the stuff to make a random number goes here
}
Is that the jist of it?
class MyApplication
{
private int a;
private int b;
public static void main(String[] args) {
new MyApplication.run();
}
public void run() {
doStuff();
doOtherStuff();
}
private void doStuff() {
this.a = 1;
}
private void doOtherStuff() {
this.b = 2;
}
}
typedef struct
{
int a;
int b;
} ApplicationState;
void doStuff(ApplicationState* as)
{
as->a = 1;
}
void doOtherStuff(ApplicationState* as)
{
as->b = 2;
}
int main(int argc, char* argv[])
{
ApplicationState state;
doStuff(&state);
doOtherStuff(&state);
return 0;
}
class MyApplication
{
private int a;
private int b;
...
private void doStuff() {
this.a = 1;
}
private void doOtherStuff() {
this.b = 2;
}
}