VC ++ says that "no overloaded function takes 7 arguments", I say "YES, THIS!

In my class header file, PDBComponentI simply created a new constructor for a total of two constructors:

class PDBComponent {
    public:
        PDBComponent(string name,double min_current,double nom_current,
                     double max_current, EPSCommands* command_ptr, double delay);
        PDBComponent(string name,double min_current,double nom_current,
                     double max_current, EPSCommands* command_ptr, EPSFault* fault_ptr ,double delay);
...

And when I use the first constructor, I do not see a compilation error. For instance:

PDBComponent component = PDBComponent("STX"     ,0.1,  0.5,  1.0
        ,new EPSCommands( 1.0, 3.0),0.0);

However, when I use the second constructor, I get a compilation error ::

PDBComponent component = PDBComponent("STX"     ,0.1,  0.5,  1.0
        ,new EPSCommands( 1.0, 3.0), new EPSFault(EPSFault::OpenCircuit,2.0),0.0);

Compilation Error:

error C2661: 'fs5system :: PDBComponent :: PDBComponent': no ​​overloaded function takes 7 arguments

I thought that maybe I was working with one header file when the compiler was looking at another, so I commented on the first constructor. The compiler showed that it recompiled PDBComponent.cpp and then showed an error:

C2511: 'fs5system:: PDBComponent:: PDBComponent (std::string, double, double, double, fs5system:: EPSCommands *, double)': - 'fs5system:: PDBComponent'

..., , .

- , ?

Visual Studios ++.


:

:

bool trash() {return true;}

PDBComponent* component;
component = new PDBComponent("STX"     ,0.1,  0.5,  1.0
        ,new EPSCommands( 1.0, 3.0),0.0);

cout << component->trash() << endl;

. PDBComponent . :

C2039: 'trash': 'fs5system:: PDBComponent'

+3
2

, , 6 , , , ? , - - (, ).

/showIncludes ( "++ | Advanced | Show includes" IDE) / , .

+5

, EPSFault , , ( ).

, , new - , std::bad_alloc, .

+1

Source: https://habr.com/ru/post/1759947/