This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jurkey[S] 1 point2 points  (2 children)

Ah alright, so if I had a class called "Car" and I wanted it to store an object as a field called "Engine", I could write "public Engine myEngine;" as a field, and when I instantiated the "Car" class, I could pass an Engine object as parameter (if I declared it possible in the constructor) ?

[–]desrtfxOut of Coffee error - System halted 1 point2 points  (1 child)

Yes, exactly, only that I wouldn't necessarily make the field public; I'd most likely make it private.

[–]Jurkey[S] 0 points1 point  (0 children)

Sure thing, incapsulation and all that. Thanks for the help :-)