Re: A Good OOP Tutorial/Read?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



interface Shape {
     public double getArea();
}

class Circle implements Shape {
  double radius;
  public Circle(int double radius) {
    this.radius = radius;
  }

  public double getArea() {
    return (radius * radius * 3.1415);
  }

}

class Square implements Shape {
  double side;

  public Square(int double side) {
    this.side = side;
  }

  double getArea() {
    return (side * side);
  }
}


Please make an effort to understand polymorphic concepts of OOP as
they are rudimentary. Without that one will never grasp OO Patterns
(Gang of Four).

Ninus.

On 5/16/13, Tedd Sperling <tedd.sperling@xxxxxxxxx> wrote:
> Thanks to both Bastien and Sebastian:
>
> While I understand that an interface is like an abstract Class, in that you
> don't have to flesh-out your methods, but rather where you define exactly
> how Classes who implement that interface will be required to flesh-out those
> methods. But so what? What's the point?
>
> Without giving me complicated examples, just give me one simple example that
> illustrates the advantage of using an interface over writing a new Class
> where you flesh-out whatever methods you want. After all, an interface
> requires the same thing, does it not?
>
> As such, I just don't see the advantage interfaces bring.
>
> Cheers,
>
> tedd
>
>
> _____________________
> tedd.sperling@xxxxxxxxx
> http://sperling.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux