How does Object Oriented Programming work?

Posted by venom on Stack Overflow See other posts from Stack Overflow or by venom
Published on 2010-03-28T12:31:55Z Indexed on 2010/03/28 14:03 UTC
Read the original article Hit count: 187

Filed under:
|
|

Hello, I am not sure about some things in OOP.

If I have Class1, which has some private field, for example private Field field1, and make

getField1 () {
    return field1;
}

then I have some class with constructor

public Class2 (Field field) { 
    someMethod(field);
}

And then I call constructor of Class2 in Class3 like:

Class2 cl = new Class2(instanceOfClass1.getField1());

And now the question: Am I working with field1 of instanceOfClass1 in someMethod(field)?

© Stack Overflow or respective owner

Related posts about oop

Related posts about object-oriented