== Why is this an issue?

:func_name: method

include::../description.adoc[]

[source,cpp,diff-id=1,diff-type=noncompliant]
----
class Circle : public Shape {
private:
  int radius;
public:
  void setWidth(int size) {
    radius = size / 2;
    updateShape();
  }

  void setHeight(int size) {  // Noncompliant: duplicates setWidth
    radius = size / 2;
    updateShape();
  }
};
----

include::../inter.adoc[]

[source,cpp,diff-id=1,diff-type=compliant]
----
class Circle : public Shape {
private:
  int radius;
public:
  void setWidth(int size) {
    setDiameter(size);
  }

  void setHeight(int size) {
    setDiameter(size);
  }

private:
  void setDiameter(int size) { // Implementation is shared
    radius = size / 2;
    updateShape();
  }
};
----

This rule raises an issue on methods and not free functions.

=== Exceptions

Empty methods, methods with the same name (overload) and methods with only one statement are ignored.

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
