• Post Reply Bookmark Topic Watch Topic
  • New Topic

can any one explain me how interfaces provides encapsulation ?  RSS feed

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one explain me how interfaces provides encapsulation
my miss says me :
when you write some thing like // where Shape is an interface , it actually provides encapsulation because user can only see that s is of type Shape and not which object is getting created .

totally i didnt get that at all
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interface don't provide encapsulation. They can provide flexibility and information-hiding.
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interfaces are also Java's way of dealing with the issues surrounding multiple-inheritance, such as those experienced by C++ (i.e. the "diamond" problem").
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:Interface don't provide encapsulation. They can provide flexibility and information-hiding.

how ??? please show with eg :
thanks for the reply
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just search for those terms, you'll find a ton of information.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!