- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
来自答案here我实现了我的类 NotImplementedException
//exceptions.h
namespace base
{
class NotImplementedException : public std::logic_error
{
public:
virtual char const* what() { return "Function not yet implemented."; }
};
}
在另一个类中我想抛出以下异常(相同的命名空间):
std::string to_string() override
{
throw NotImplementedException();
}
to_string
方法是来自抽象基类的重写方法。
namespace BSE {
class BaseObject
{
virtual std::string to_string() = 0;
};
}
不幸的是,前面代码的编译显示了这个错误:
error C2280: BSE::NotImplementedException::NotImplementedException(void)': attempting to reference a deleted function`
来自 here我知道这个问题与 move 构造函数或赋值有关,根据 cppreference.com - throw (1)可能是这种情况:
First, copy-initializes the exception object from expression (this may call the move constructor for rvalue expression, and the copy/move may be subject to copy elision)
我尝试添加
NotImplementedException(const NotImplementedException&) = default;
NotImplementedException& operator=(const NotImplementedException&) = default;
我的类(class),但这给了我
error C2512: 'BSE::NotImplementedException': no appropriate default constructor available
据我所知,std::logic_error
没有定义默认构造函数。
问:我该如何解决这个问题?
最佳答案
应该是这样的:
namespace base
{
class NotImplementedException : public std::logic_error
{
public:
NotImplementedException () : std::logic_error{"Function not yet implemented."} {}
};
}
然后
std::string to_string() override
{
throw NotImplementedException();
}
关于c++ - NotImplementedException C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42939299/
我发现有 2 个 NotImplementedException: sun.reflect.generics.reflectiveObjects.NotImplementedException org
我正在尝试将窗口位置保存为用户设置,以便在我的应用程序启动时恢复它。我使用这种类型的设计器添加了一个设置: using System.Configuration; namespace MyApp.Fr
我正在将以下代码添加到我的 WP7 应用程序中 App.xaml.cs 的构造函数中。 Resources["PhoneBackgroundBrush"] = new ImageBrush {
来自答案here我实现了我的类 NotImplementedException //exceptions.h namespace base { class NotImplementedExce
从逻辑上讲,所讨论的方法应该是抽象的,但它们位于继承自的父窗体上,如果将它们声明为抽象的,Visual Studio 将适用。 好的,我让尸体抛出一个NotImplementedException。
我有一个 A 类,一个继承的 B 类,以及另一个继承自 B 的 C 类。 在我的类 A 中,我只想定义一些方法而不是实现它,如果我将它声明为抽象的,我必须在我的继承类中实现它,而我不想要它。例如,我想
下面的代码不断抛出异常 throw new NotImplementedException() 并且我不确定如何修复它。我正在 try catch 下面存储过程返回的日期时间。 public void
我很确定以前版本的 Visual Studio Code Analysis 警告过 NotImplementedException 的使用,即包含此的任何成员 throw new NotImpleme
NET Framework 中的 C# 有一个方便的 NotImplementedException ,我可以从我打算稍后编写的代码部分中抛出。 Julia 中是否有类似的断言? 最佳答案 只需使用
锁定。这个问题及其答案是locked因为这个问题是题外话,但具有历史意义。它目前不接受新的答案或互动。 这真的,真的让我感到不安,所以我希望有人能给我一个合理的理由来解释为什么事情是这样。 未实现异常
如果我在 Reflector 中检查 FieldInfo.SetValueDirect它看起来如下: C#、.NET 4.0: [CLSCompliant(false)] public virtual
我正在研究使用 mocking 进行单元测试,我将添加到现有代码中。为此,我使用 HippoMocks .这涉及另一个类在我的模拟上调用一些方法(都是虚拟的)。我想避免过度指定所有这些,但是每当其他类
我已经试过了,但它似乎不起作用: Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException
我正在尝试实现 Facebook authentication sample ,当代码到达; WebAuthenticationResult webAuthenticationResult = aw
不知道有没有人遇到过这个问题。 我正在 VS 2012 中开发 C# Windows Phone 8 应用。 我最近遇到了 System.NotImplementedException 类型的未处理异
当我尝试使用 ant 构建我的项目时收到以下警告。我的 build.xml 是从 Eclipse 自动生成的: warning: NotImplementedException is internal
android平台有没有类似NotImplementedException的东西? 谢谢! 最佳答案 我认为你应该使用 UnsupportedOperationException . 关于androi
我有一个 Moq DbSet 直到最近一直在工作,但是自从上次更新依赖项以来,它一直在 IQueryable.Provider 上抛出 NotImplementedException 代码使用如下:
有什么方法可以序列化以下类的对象并以某种方式忽略抛出的异常吗? public class HardToSerialize { public string IAmNotTheProblem { ge
我正在使用 ASP.NET 3.5。我制作了一个表单,当用户单击一个按钮时,它应该加载另一个包含信息的页面。我没有加载而是收到此错误页面: The method or operation is not
我是一名优秀的程序员,十分优秀!