Skip to content

Commit 6fc9ea1

Browse files
author
Colin Robertson
committed
Fixes to C2280 indirect example
1 parent eef41f2 commit 6fc9ea1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎docs/error-messages/compiler-errors-1/compiler-error-c2280.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ Versions of the compiler before Visual Studio 2015 Update 2 were non-conforming
167167
In this example, class `top` indirectly derives from private virtual `base`. In conforming code, this makes the members of `base` inaccessible to `top`; an object of type `top` can't be instantiated or destroyed. To fix this issue in code that relied on the old compiler behavior, change the intermediate class to use `protected virtual` derivation, or change the `top` class to use direct derivation:
168168
169169
```cpp
170-
// C2280a.cpp
171-
// compile with: cl /c C2280a.cpp
170+
// C2280_indirect.cpp
171+
// compile with: cl /c C2280_indirect.cpp
172172
class base
173173
{
174174
protected:
@@ -179,7 +179,7 @@ protected:
179179
class middle : private virtual base {};
180180
// Possible fix: Replace line above with:
181181
// class middle : protected virtual base {};
182-
class top : public virtual middle {};
182+
class top : public virtual middle {}; // C4594, C4624
183183
// Another possible fix: use direct derivation:
184184
// class top : public virtual middle, private virtual base {};
185185

0 commit comments

Comments
 (0)