我在PHP中遇到了OOP中的一个问题。我试图实现一个抽象的父类方法,并从子类,我必须使用它与可变数目的参数。 这里是抛出的错误: PHP Fatal error: Declaration of Square::getArea($length) must be compatible with Shape::getArea() 及其类别: abstract class Shape {
abs
我有下面的代码,我不断收到错误必须有一个身体,因为它没有标记为抽象的extern或部分。 public interface Shape{
int GetArea();
}
public class shape:Shape{
int height;
int width;
int radius;
int GetArea();
}
class
我有一个抽象类,只有一个抽象方法;和一些实施班(约6人)。 该方法返回一个“需要”两个参数的对象。 但是,在某些情况下,只需要两个参数中的一个。 有没有一种优雅的方式来实现这种情况? (而不是返回该参数为空) public class NormResult {
protected List<String> normWords;
protected List<String> un
我有一个抽象类,并为它执行两个实现。 public abstract class Person{
public abstract string GetName();
}
public class Doctor : Person{
public override string GetName()
{
return "Doctor";
}
}