aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner Class & HAS-a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Class & HAS-a class" Watch "Inner Class & HAS-a class" New topic
Author

Inner Class & HAS-a class

chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
Hello ranchers !

I have quick question,

inner class = has-a class = delegation of task

class A class B {
{ || private C c;
void check () { || void add () {
|| c.add();
Inner i = new Inner(); } }
i.delegate();
}

just wanted to make sure that is that the same thing..
i know access modifiers along like static n outer does not have access to any of inner members but the reverse is true ..and all

thanks in advance

chintan
chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
sorry it's just kinda mix..

class A {

void test () {

Inner i = new Inner(); // it's the same thing of delegation or
i.check(); adding more power to class
}

class B {

private C c ;

void add () {

c.sum(); //here it's just delegation of function to other
class
}

just want to make sure it's the same thing or is there any other underlying features among them

-- sorry for the above
-- thanks in advance

-chintan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inner Class & HAS-a class