草庐IT

NotImplementedException

全部标签

python - Golang 相当于 Python 的 NotImplementedException

当您定义一个包含您不想实现的方法的接口(interface)时,Golang中是否有等同于在Python中引发NotImplementedException的方法?这是地道的Golang语言吗?例如:typeMyInterfaceinterface{Method1()boolMethod2()bool}//ImplementthisinterfacetypeThingstruct{}func(t*Thing)Method1()bool{returntrue}func(t*Thing)Method2()bool{//Idon'twanttoimplementthisyet}

c++ - C++ 是否具有与 .NET 的 NotImplementedException 等价的功能?

C++标准库是否包含与.NET的NotImplementedException等效的异常?如果没有,处理我打算稍后完成的不完整方法的最佳做法是什么? 最佳答案 本着@dustyrockpyle的精神,我从std::logic_error继承,但我使用该类的字符串构造函数,而不是覆盖what()classNotImplemented:publicstd::logic_error{public:NotImplemented():std::logic_error("Functionnotyetimplemented"){};};