what is the purpose of an abstract 3f

Solutions on MaxInterview for what is the purpose of an abstract 3f by the best coders in the world

showing results for - "what is the purpose of an abstract 3f"
Elyas
07 Feb 2019
1abstract class AbstractDonater
2{
3    public function donateMinimum(): void
4    {
5        // this method can be complex
6        $minimum = 10;
7        $this->donate($minimum)
8    }
9    abstract protected function donate(int $money);
10} 
11
12class ConcreteDonaterOne 
13{
14    protected function donate(int $money)
15    {
16        $donateProvider = new PlayPal();
17        $donateProvider->pay($money);
18    }
19}
20
21class ConcreteDonaterTwo 
22{
23    protected function donate(int $money)
24    {
25        $donateProvider = new Scribe();
26        $donateProvider->transfer($money);
27    }
28}
29$donaters = [
30    new ConcreteDonaterOne(),
31    new ConcreteDonaterTwo(),
32
33];
34
35foreach ($donaters as $donater)
36{
37    $donater->donateMinimum();
38}
39
similar questions
queries leading to this page
what is the purpose of an abstract 3f