-4

Although I suspect the answer here is to refactor, I'd like to avoid that due to time constraints.

What I have is a class C, that publicly inherits from interface A, that publicly inherits from interface B, that publicly inherits from class O.

O has a protected constructor. A and B don't have a constructor (or at least I'm not defining one. Are they inherited? deleted?) C has a public constructor. Calling said constructor results in a compile error:

'B::B(void)': attempting to reference a deleted function

class C : public A {
public:
C(){};
~C(){};
}

C::C() {
this->property = value;
}

class O {
public:
virtual ~O(){};
protected:
O(){};
}

class B : public O {
public:
virtual ~B(){};
}

class A : public B {
public:
virtual ~A(){};
}

using visual studio 2015.

Again, if possible would like to avoid a major refactor. Is there quick(ish) solution?

Edit: When calling C's constructor, it's in the form of O* object = new C();

1 Answers1

0

I believe this to be related to "default constructor cannot be referenced" in Visual Studio 2015

Work around found by giving the interfaces protected constructors. Not ideal but works, thank you all.

Community
  • 1
  • 1