Skip to content

Commit 2433722

Browse files
Merge pull request #5475 from Rageking8/simplify-example-and-update-c2556-error-reference
Simplify example and update C2556 error reference
2 parents 7e272e0 + c79bf08 commit 2433722

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
---
2-
description: "Learn more about: Compiler Error C2556"
32
title: "Compiler Error C2556"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2556"
4+
ms.date: 06/29/2025
55
f1_keywords: ["C2556"]
66
helpviewer_keywords: ["C2556"]
7-
ms.assetid: fc4399ad-45b3-49fd-be1f-0b13956a595a
87
---
98
# Compiler Error C2556
109

11-
'identifier' : overloaded functions only differ by return type
10+
> '*function1*': overloaded function differs only by return type from '*function2*'
11+
12+
## Remarks
1213

1314
The overloaded functions have different return types but the same parameter list. Each overloaded function must have a distinct formal parameter list.
1415

15-
The following sample generates C2556:
16+
## Example
17+
18+
The following example generates C2556:
1619

1720
```cpp
1821
// C2556.cpp
1922
// compile with: /c
20-
class C {
21-
int func();
22-
double func(); // C2556
23-
int func(int i); // ok parameter lists differ
24-
};
23+
int func();
24+
double func(); // C2556
25+
int func(int i); // OK parameter lists differ
2526
```

docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The articles in this section of the documentation explain a subset of the error
7171
|[Compiler error C2553](compiler-error-C2553.md)|'*type* *derived_class*::*function*': overriding virtual function return type differs from '*type* *base_class*::*function*'|
7272
|Compiler error C2554|'*variable*': 'constinit' only allowed on a variable declaration with static or thread storage duration|
7373
|[Compiler error C2555](compiler-error-C2555.md)|'*derived_class*::*function*': overriding virtual function return type differs and is not covariant from '*base_class*::*function*'|
74-
|[Compiler error C2556](compiler-error-C2556.md)|'*type1* *class*::*function*': overloaded function differs only by return type from '*type2* *class*::*function*'|
74+
|[Compiler error C2556](compiler-error-C2556.md)|'*function1*': overloaded function differs only by return type from '*function2*'|
7575
|[Compiler error C2557](compiler-error-C2557.md)|'*identifier*': private and protected members cannot be initialized without a constructor|
7676
|[Compiler error C2558](compiler-error-C2558.md)|class '*class*': no copy constructor available or copy constructor is declared 'explicit'|
7777
|Compiler error C2559|'*identifier*': cannot overload a member function without ref-qualifier with a member function with ref-qualifier|

0 commit comments

Comments
 (0)