Partial Classes

If we are using same class for different purposes we can extend it, and add
new properties and methods. But we will also have to use new class name,
when we create objects. C# provides a better concept "Partial Classes". Why
not to also implement it in PHP?

Example:

Partial Class abc {

  public function sayhi() {
   echo "Hi";
  }

}

Partial Class abc {

  public function sayhello() {
   echo "Hello";
  }

}

Q: What will happen if both classes contain same method names?
A: We will show error method already exists.

Q: Will it break any existing code?
A: No, there will be no impact on any existing coding because we are not
changing anything.

Reply via email to