peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.33k stars 202 forks source link

virtual and override #1114

Closed N0zzy closed 1 year ago

N0zzy commented 1 year ago

image

I apologize for stupid questions. there is such an example with the result of a pie. below are methods with "signature" virtual. How can I change to "override" and is it possible?

jakubmisek commented 1 year ago

override is on overridden methods (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/override).

You cannot "change" it to override. To define an overriden method, you have to override a virtual method:

class A {
  function foo() {/* do somethig */} // public virtual void foo()
}
class B extends A {
  function foo() {/* do something else */} // public override void foo()
}