Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. class A {
  2.     private B; //B is now A's responsibility THROUGH ITS LIFETIME
  3.     public A() {
  4.         B = new B();
  5.         Transform();
  6.     }
  7.  
  8.     void Transform() {
  9.         //Do work on B ONCE
  10.     }
  11. }
  12.  
  13. class B {
  14.     // B has some fields of primitive types
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement