Instantiation vs. Typed reference

Posted by Farstucker on Stack Overflow See other posts from Stack Overflow or by Farstucker
Published on 2010-05-13T12:53:14Z Indexed on 2010/05/13 13:04 UTC
Read the original article Hit count: 194

Filed under:
|
|

Just when I think Im starting to understand the basics, I find something that brings me right back to reality. In this case, typed reference.

I found an example similar to this:

class Worker
{
Boss boss;

public void Advise(Boss pBoss)
{
    this.boss = pBoss;
}

How can you reference methods within the Boss class if its not static and not instantiated?

I guess my real question is whats the difference between:
Boss boss;
and
Boss boss = new Boss();

Thank you,
FS

© Stack Overflow or respective owner

Related posts about typedreference

Related posts about instantiation