0
Stéphane Ducasse 1
Stéphane Ducasse
stephane.ducasse@inria.fr
http://stephane.ducasse.free.fr/
Design Points - Dual
Interf...
S.Ducasse 2
Clients?
• Clients
• Subclasses
S.Ducasse 3
What are the consequences?
A
{ private x ;
void foo(){ ... x ...}
}
S.Ducasse 4
What can I do as a subclass?
I cannot access x
I cannot replace x
I cannot extend!
S.Ducasse 5
The idiom is
Fields are private AND you provide protected
accessors
OR
Fields are protected
S.Ducasse 6
Benefits
Your clients cannot access your fields
But your subclasses are empowered
S.Ducasse 7
Two users
S.Ducasse 8
Two Users
S.Ducasse 9
Clients
A class has always two clients:
its clients and its extenders
S.Ducasse 9
Clients
A class has always two clients:
its clients and its extenders
Upcoming SlideShare
Loading in...5
×

Stoop ed-dual interface

232

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
232
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Stoop ed-dual interface"

  1. 1. Stéphane Ducasse 1 Stéphane Ducasse stephane.ducasse@inria.fr http://stephane.ducasse.free.fr/ Design Points - Dual Interfaces Stéphane Ducasse --- 2005
  2. 2. S.Ducasse 2 Clients? • Clients • Subclasses
  3. 3. S.Ducasse 3 What are the consequences? A { private x ; void foo(){ ... x ...} }
  4. 4. S.Ducasse 4 What can I do as a subclass? I cannot access x I cannot replace x I cannot extend!
  5. 5. S.Ducasse 5 The idiom is Fields are private AND you provide protected accessors OR Fields are protected
  6. 6. S.Ducasse 6 Benefits Your clients cannot access your fields But your subclasses are empowered
  7. 7. S.Ducasse 7 Two users
  8. 8. S.Ducasse 8 Two Users
  9. 9. S.Ducasse 9 Clients A class has always two clients: its clients and its extenders
  10. 10. S.Ducasse 9 Clients A class has always two clients: its clients and its extenders
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×