Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. class User{
  2. public $name;
  3. public function __construct($name)
  4. {
  5. $this-> name = $name;
  6. }
  7. }
  8.  
  9. class Product{
  10. public $price;
  11. public $name;
  12. public function __construct($price, $name){
  13. $this->price = $price;
  14. $this->name = $name;
  15. }
  16. }
  17.  
  18. class Order{
  19. public $user;
  20. public $productName;
  21. public $productPrice;
  22. public function __construct(\Product $product \User $user){
  23. $this->productName = $product->name;
  24. $this->productPrice = $product->name;
  25. $this->user = $user->name;
  26.  
  27. return $this;
  28. }
  29.  
  30. $user = new User("Hungry");
  31. $product = new Product(100,"banana");
  32. $order = new Order($product, $user);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement