SlideShare a Scribd company logo
1 of 1
Download to read offline
How do I declare the following constructors in my .h file?
Below was the original code.
#include const int CAPACITY =1024; using namespace std; typedef int ElementType; // Now
"ElementType" is "int" L//can change int to double, char,... class List { public: List();
//constructor unsigned size() const; bool empty() const; //check if empty void
insert(ElementType item, int pos); //insertion void erase(int pos); //deletion void
display(ostream& out) const; //display every item ElementType get(unsigned pos) const;
private: int mySize; // current # of items in list int myArray[CAPACITY]; No issues found 4
Error List Entire
Solution
(i) 0 Messages Q7 Build + IntelliSense " Code Description abc E0135 class "List" has no
member "removeAll" abc E0020 identifier "myArray" is undefined abc E0020 identifier
"mySize" is undefined abc E0020 identifier "mySize" is undefined abc E0493 no instance of
overloaded function "List::List" matches the specified type
#include #include cstdlib> #include "list.h" using namespace std; void List: :
insert(ElementType item, int pos) { if (mySize == CAPACITY) exit(1); if (pos< 0|| pos >
mysize) return; // shift array elements right to make room for for (int i= mysize; i> pos; i )
myArray[i]=myArray[i1]; // insert item at pos and increase list size myArray [pos] = item;
mySize++; // don't forget this! } void List: :erase(int pos) { if (pos<0 || pos >= mySize) return;
// shift array elements left for (int i= pos; i < mysize-1; i++ ) myArray[i]=myArray[i+1]; }
mySize--; // don't forget this! List: : List( ) { mySize =0; } bool List: :empty() const { return
(mySize ==0 ); } unsigned List::size() const { return mysize; } ElementType List:
:get(unsigned pos) const { if (pos >= mysize) { cerr "Invalid Index." endl; exit(1); } return
myArray[pos]; } void List: : display(ostream & out) const { for (int i=0; i

More Related Content

Similar to How do I declare the following constructors in my .h file Below.pdf

Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
Pleae help me with this C++ question, ill upvote thanks.Write the .pdfPleae help me with this C++ question, ill upvote thanks.Write the .pdf
Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
vinodagrawal6699
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
info334223
 
-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx
Adamq0DJonese
 
My question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdfMy question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdf
jeetumordhani
 
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdfJAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
arpaqindia
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
fantoosh1
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
DIPESH30
 
C++ Linux Need help with lab assignment Instructions posted.pdf
C++ Linux Need help with lab assignment  Instructions posted.pdfC++ Linux Need help with lab assignment  Instructions posted.pdf
C++ Linux Need help with lab assignment Instructions posted.pdf
accuratemobilepune
 
Written in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdfWritten in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdf
sravi07
 
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdfWritten in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
sravi07
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
flashfashioncasualwe
 
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
ganisyedtrd
 
Revisiting a data structures in detail with linked list stack and queue
Revisiting a data structures in detail with linked list stack and queueRevisiting a data structures in detail with linked list stack and queue
Revisiting a data structures in detail with linked list stack and queue
ssuser7319f8
 

Similar to How do I declare the following constructors in my .h file Below.pdf (20)

Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
Pleae help me with this C++ question, ill upvote thanks.Write the .pdfPleae help me with this C++ question, ill upvote thanks.Write the .pdf
Pleae help me with this C++ question, ill upvote thanks.Write the .pdf
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
 
-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx
 
My question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdfMy question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdf
 
Adt of lists
Adt of listsAdt of lists
Adt of lists
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docx
 
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdfJAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
dynamicList.ppt
dynamicList.pptdynamicList.ppt
dynamicList.ppt
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
C++ Linux Need help with lab assignment Instructions posted.pdf
C++ Linux Need help with lab assignment  Instructions posted.pdfC++ Linux Need help with lab assignment  Instructions posted.pdf
C++ Linux Need help with lab assignment Instructions posted.pdf
 
Written in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdfWritten in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdf
 
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdfWritten in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
 
Get started with Reason
Get started with ReasonGet started with Reason
Get started with Reason
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
 
강의자료7
강의자료7강의자료7
강의자료7
 
Arrays
ArraysArrays
Arrays
 
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdf
 
Revisiting a data structures in detail with linked list stack and queue
Revisiting a data structures in detail with linked list stack and queueRevisiting a data structures in detail with linked list stack and queue
Revisiting a data structures in detail with linked list stack and queue
 

More from Conint29

Given BinaryNode.javapackage util;import java.util.;T.pdf
Given BinaryNode.javapackage util;import java.util.;T.pdfGiven BinaryNode.javapackage util;import java.util.;T.pdf
Given BinaryNode.javapackage util;import java.util.;T.pdf
Conint29
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdf
Conint29
 
Domain Description for the Lunar Rover Back in July 30th 1971, the c.pdf
Domain Description for the Lunar Rover  Back in July 30th 1971, the c.pdfDomain Description for the Lunar Rover  Back in July 30th 1971, the c.pdf
Domain Description for the Lunar Rover Back in July 30th 1971, the c.pdf
Conint29
 
I need help with this assignment Ive gotten abit stuck with the cod.pdf
I need help with this assignment Ive gotten abit stuck with the cod.pdfI need help with this assignment Ive gotten abit stuck with the cod.pdf
I need help with this assignment Ive gotten abit stuck with the cod.pdf
Conint29
 
I am looking for some assistance with SQLite database. I have tried se.pdf
I am looking for some assistance with SQLite database. I have tried se.pdfI am looking for some assistance with SQLite database. I have tried se.pdf
I am looking for some assistance with SQLite database. I have tried se.pdf
Conint29
 
Here I have a function in my code that checks the separation of airc.pdf
Here I have a function in my code that checks the separation of airc.pdfHere I have a function in my code that checks the separation of airc.pdf
Here I have a function in my code that checks the separation of airc.pdf
Conint29
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
Encapsulating method details in a class [ Choose ] instance vari.pdf
Encapsulating method details in a class [ Choose ] instance vari.pdfEncapsulating method details in a class [ Choose ] instance vari.pdf
Encapsulating method details in a class [ Choose ] instance vari.pdf
Conint29
 
Hello. I need help with my assignment. Translate the ER Diagram for .pdf
Hello. I need help with my assignment. Translate the ER Diagram for .pdfHello. I need help with my assignment. Translate the ER Diagram for .pdf
Hello. I need help with my assignment. Translate the ER Diagram for .pdf
Conint29
 

More from Conint29 (13)

Given BinaryNode.javapackage util;import java.util.;T.pdf
Given BinaryNode.javapackage util;import java.util.;T.pdfGiven BinaryNode.javapackage util;import java.util.;T.pdf
Given BinaryNode.javapackage util;import java.util.;T.pdf
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdf
 
Domain Description for the Lunar Rover Back in July 30th 1971, the c.pdf
Domain Description for the Lunar Rover  Back in July 30th 1971, the c.pdfDomain Description for the Lunar Rover  Back in July 30th 1971, the c.pdf
Domain Description for the Lunar Rover Back in July 30th 1971, the c.pdf
 
Design a PIC based wearable device that keeps a tract of the activit.pdf
Design a PIC based wearable device that keeps a tract of the activit.pdfDesign a PIC based wearable device that keeps a tract of the activit.pdf
Design a PIC based wearable device that keeps a tract of the activit.pdf
 
Describe any five (5) advantages of computer networkingList any (5) ex.pdf
Describe any five (5) advantages of computer networkingList any (5) ex.pdfDescribe any five (5) advantages of computer networkingList any (5) ex.pdf
Describe any five (5) advantages of computer networkingList any (5) ex.pdf
 
I need help with this assignment Ive gotten abit stuck with the cod.pdf
I need help with this assignment Ive gotten abit stuck with the cod.pdfI need help with this assignment Ive gotten abit stuck with the cod.pdf
I need help with this assignment Ive gotten abit stuck with the cod.pdf
 
I am looking for some assistance with SQLite database. I have tried se.pdf
I am looking for some assistance with SQLite database. I have tried se.pdfI am looking for some assistance with SQLite database. I have tried se.pdf
I am looking for some assistance with SQLite database. I have tried se.pdf
 
how to Create a PDF holding all of your database data from Module 8..pdf
how to Create a PDF holding all of your database data from Module 8..pdfhow to Create a PDF holding all of your database data from Module 8..pdf
how to Create a PDF holding all of your database data from Module 8..pdf
 
Here I have a function in my code that checks the separation of airc.pdf
Here I have a function in my code that checks the separation of airc.pdfHere I have a function in my code that checks the separation of airc.pdf
Here I have a function in my code that checks the separation of airc.pdf
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
 
Exchange Rate Determination Theory OvershootingExchange rate over.pdf
Exchange Rate Determination Theory OvershootingExchange rate over.pdfExchange Rate Determination Theory OvershootingExchange rate over.pdf
Exchange Rate Determination Theory OvershootingExchange rate over.pdf
 
Encapsulating method details in a class [ Choose ] instance vari.pdf
Encapsulating method details in a class [ Choose ] instance vari.pdfEncapsulating method details in a class [ Choose ] instance vari.pdf
Encapsulating method details in a class [ Choose ] instance vari.pdf
 
Hello. I need help with my assignment. Translate the ER Diagram for .pdf
Hello. I need help with my assignment. Translate the ER Diagram for .pdfHello. I need help with my assignment. Translate the ER Diagram for .pdf
Hello. I need help with my assignment. Translate the ER Diagram for .pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 

How do I declare the following constructors in my .h file Below.pdf

  • 1. How do I declare the following constructors in my .h file? Below was the original code. #include const int CAPACITY =1024; using namespace std; typedef int ElementType; // Now "ElementType" is "int" L//can change int to double, char,... class List { public: List(); //constructor unsigned size() const; bool empty() const; //check if empty void insert(ElementType item, int pos); //insertion void erase(int pos); //deletion void display(ostream& out) const; //display every item ElementType get(unsigned pos) const; private: int mySize; // current # of items in list int myArray[CAPACITY]; No issues found 4 Error List Entire Solution (i) 0 Messages Q7 Build + IntelliSense " Code Description abc E0135 class "List" has no member "removeAll" abc E0020 identifier "myArray" is undefined abc E0020 identifier "mySize" is undefined abc E0020 identifier "mySize" is undefined abc E0493 no instance of overloaded function "List::List" matches the specified type #include #include cstdlib> #include "list.h" using namespace std; void List: : insert(ElementType item, int pos) { if (mySize == CAPACITY) exit(1); if (pos< 0|| pos > mysize) return; // shift array elements right to make room for for (int i= mysize; i> pos; i ) myArray[i]=myArray[i1]; // insert item at pos and increase list size myArray [pos] = item; mySize++; // don't forget this! } void List: :erase(int pos) { if (pos<0 || pos >= mySize) return; // shift array elements left for (int i= pos; i < mysize-1; i++ ) myArray[i]=myArray[i+1]; } mySize--; // don't forget this! List: : List( ) { mySize =0; } bool List: :empty() const { return (mySize ==0 ); } unsigned List::size() const { return mysize; } ElementType List: :get(unsigned pos) const { if (pos >= mysize) { cerr "Invalid Index." endl; exit(1); } return myArray[pos]; } void List: : display(ostream & out) const { for (int i=0; i