继承带有双下划线的类属性
作者:aviro 提问时间:10/31/2017
我想我理解 python 中“名称修改”的概念,但我可能错过了一些东西。请看以下代码: #!/usr/bin/env python class Base(object): __data = "B...
继承 问答列表
作者:aviro 提问时间:10/31/2017
我想我理解 python 中“名称修改”的概念,但我可能错过了一些东西。请看以下代码: #!/usr/bin/env python class Base(object): __data = "B...
作者:Aaron 提问时间:3/17/2011
嗨,所以我正在尝试使用面向对象编程来了解 inherteince 如何在 PHP 中工作。主类是 Computer,继承的类是 Mouse。我正在使用 mouse 类扩展 Computer 类。我在每...
作者:Yokke 提问时间:7/12/2023
我有一个子异常,它继承了他的父级,扩展到 Exception 类: namespace Exceptions; use Exception; class InvalidFieldExcept...
作者:ModernEraCaveman 提问时间:6/2/2023
我正在尝试在对象构造函数中设置一个多类型名方法以从派生类中调用,但我无法弄清楚为什么会出现以下错误: no instance of constructor "VBO::VBO" matches th...
作者:fredoverflow 提问时间:7/29/2012
维基百科在C++11 final修饰符上有以下示例: struct Base2 { virtual void f() final; }; struct Derived2 : Base2 { v...
作者:opnightfall1771 提问时间:10/31/2021
在 Python 中,我有两个协议,其中一个继承自另一个: class SupportsFileOperations(Protocol): ... class SupportsMediaOper...
作者:Sideshow Bob 提问时间:3/23/2016
给定一个指向抽象基类的指针,我想复制或赋值它(作为基类)并调用派生的复制构造函数或赋值运算符。我知道复制构造函数不能是虚拟的,所以大概复制构造函数不是执行此操作的选项,但赋值运算符是。不过,它似乎不起...
作者:Emerson Xu 提问时间:9/26/2016
假设我们有一个基类和一个派生类: class Base { string s1; string s2; ... string s100; // Hundreds of members }; ...
作者:prestokeys 提问时间:11/26/2017
我下面的复制构造函数工作正常,但我不明白我的复制分配运算符出了什么问题。 #include <iostream> template <typename... Ts> class foo; tem...
作者:metablaster 提问时间:10/19/2019
我从中派生了一个自定义异常类std::runtime_error 静态分析器给我一个警告,如果我定义或删除默认操作(复制 ctors、复制/移动运算符、析构函数等),我应该定义或删除它们。 为了解...