in Education by
I'm creating a simple vector class in C++ using dynamic arrays. The constructor with an int parameter must be deleted. I have two errors: Deleted definition of simple_vector::simple_vector(int) from my cpp file. Previous declaration of simple_vector::simple_vector(int) from my hpp file. What's going on? The name of my class is simple_vector. It can only contain double elements. Honestly, I have no idea what to do. Hpp file simple_vector(const int a); Cpp file simple_vector::simple_vector(const int a) = delete; JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You can't mark your constructor as delete'd on its definition in the cpp file, you need to mark it on its declaration in the hpp file instead. In the hpp file, change this: simple_vector(const int a); To this: simple_vector(const int) = delete; And in the cpp file, remove this completely: simple_vector::simple_vector(const int a) = delete;

Related questions

0 votes
    I'm creating a simple vector class in C++ using dynamic arrays. The constructor with an int parameter ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I'm creating a simple vector class in C++ using dynamic arrays. The constructor with an int parameter ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    I am a beginner and I just need a bit of help on why I getline is showing an error: this is what I have so far ... payments[MAX_ITEMS]; ifstream iFile; if ( argc != 2 ) { cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I am a beginner and I just need a bit of help on why I getline is showing an error: this is what I have so far ... payments[MAX_ITEMS]; ifstream iFile; if ( argc != 2 ) { cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to concatenate a std::string and an int (24 answers) Closed 5 years ago. int i = 4; string text = "Player "; cout...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I was trying to solve this hiring contest problem (now closed) Lexicographic Rows You are given a matrix of characters. In one ... { //Current is valid if (input[i - 1][j]...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    Say I'm in a Git repository. I delete a file and commit that change. I continue working and make some ... my original project checkout. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    1. When you delete a file from a hard disk, the deleted file is stored in the Recycle Bin where you can ... Recycle Bin (b) Computer Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    deleted files are moved to option my network my computer my documents recycle bin Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    Data can be inserted, updated and deleted from a table by using a __________ object in ms access Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    data can be inserted, updated and deleted from a table by using _______ object on MS access Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    To identify the deleted records we use the ______________ (a) Existence bitmap (b) Current bitmap (c) ... , Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    How to find and restore a deleted file in a Git repository?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    When a session storage data gets deleted in HTML5? A - The Session Storage Data would be deleted by the browsers immediately after ... - Both of the above. D - None of the above....
asked Dec 2, 2020 in Technology by JackTerrance
0 votes
    What happens to detail record when a master record is deleted? What happens to child record when a parent record is deleted?...
asked Nov 11, 2020 in Technology by JackTerrance
...