Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Deleted special operations are propagated to derived class
#include <iostream> class IBase { public: IBase() = default; IBase(const IBase& other) = delete; IBase(IBase&& other) noexcept = delete; IBase& operator=(const IBase& other) = delete; IBase& operator=(IBase&& other) noexcept = delete; virtual ~IBase() = 0; virtual int GetProperty() const = 0; virtual void SetProperty(const int& property) = 0; }; inline IBase::~IBase() {} class Derived : public IBase { public: int GetProperty() const override { return m_property; }; void SetProperty(const int& property) override { m_property = property; }; private: int m_property{}; }; int main() { // One instance Derived aa; // Set "property" through a virtual method. aa.SetProperty(42); // Second instance Derived bb = aa; // This propery was set through virtual method. std::cout << "aa m_property: " << iBase.GetProperty() << "\n"; // This property was not set via copy assignment operator. See line 33 for more details. std::cout << "bb m_property: " << aBase.GetProperty() << "\n"; }
run
|
edit
|
history
|
help
0
lref assignment
list iota cout
Throttle Example (Send two requests every two seconds)
wellformed number
SimpleList Example
Recursive Function Calling Example with Stack Addresses
Mi primer ejemplo con RexTester colgado en My wall
MY FIRST OBJECT ORIENTED PROGRAM
applidiumResto_corrigé
problem_name_4