34 lines
662 B
Plaintext
34 lines
662 B
Plaintext
![]() |
When only a single ``++public++`` parameterless constructor is defined in a class, then that constructor can be removed because the compiler would generate it automatically. Similarly, empty ``++static++`` constructors and empty destructors are also wasted keystrokes.
|
||
|
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
class Sample
|
||
|
{
|
||
|
public Sample() { } // Noncompliant
|
||
|
static Sample() { } // Noncompliant
|
||
|
~Sample() { } // Noncompliant
|
||
|
|
||
|
...
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
class Sample
|
||
|
{
|
||
|
...
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
== Comments And Links
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::comments-and-links.adoc[]
|
||
|
endif::env-github,rspecator-view[]
|