Forum
Notifications
Clear all

❓ Interface vs Abstract Class — jak używacie w praktyce?

1 Posts
1 Users
0 Reactions
68 Views
(@admin)
Member Admin
Joined: 7 months ago
Posts: 42
Topic starter   [#13]

Często widzę zamieszanie:

👉 interface = kontrakt
👉 abstract class = częściowa implementacja

Ale w realnych projektach:

  • kiedy robicie interface?
  • kiedy wrzucacie base class?
  • używacie razem?

przykład:

 
interface Payment {
public function pay(float $amount): void;
}
 

vs

 
abstract class Payment {
abstract public function pay(float $amount): void;
}
 

👉 dla Was to zamienne czy nie?

Chętnie zobaczę realne use case’y 👇



   
Quote

Leave a reply

Author Name

Author Email

Title *

Maximum allowed file size is 2MB

 
Preview 0 Revisions Saved
Share: