2

只是想知道,c++中什么样的编程错误会导致杀毒软件认为编译的exe文件是病毒?当我玩指针时似乎会发生这种情况。我真的在制造对我的计算机有害的东西,还是只是防病毒软件提供了误报并且可以安全地忽略?

主要的

#include "node.h"
#include <conio.h>

int main(){
    Node a(5);
    Node b(3);
    Node c(2);
    addSuccessor(&a,&b);
    addSuccessor(&a,&c);

    _getch();
return 0;
 }

节点.h

 #include <ostream>
 #include <string>
 #include <sstream>
 #include <iostream>
 #include <vector>
 using namespace std;
 class Node{
     public:
         Node();
         Node(short s);
         ~Node();
         void setValue(short s);
         short getValue();
         vector<Node*> getSuccessors();
         friend ostream & operator <<(ostream &os, Node &n);
     private:
         short value;
         vector<Node*> successors;
 };
 void addSuccessor(Node* initial, Node* successor)

节点.cpp

#include "node.h"
#include <string>

Node:: Node(){
    value = 0;
}
Node::~Node(){
}
Node:: Node(short s){
    value = s; 
}
void Node::setValue(short n){
    value = n;
}
short Node::getValue(){
    return value;
}
vector<Node*> Node::getSuccessors(){
    return successors;
}

void addSuccessor(Node* initial, Node* successor){
    initial->getSuccessors().push_back(successor);
}


ostream & operator <<(ostream &os, Node &n){
    os << "N:"<< n.getValue() << "\n";
    return os;
}
4

0 回答 0