Question
I keep getting an error how do I fix this error [Error] invalid conversion from 'int' to 'const char*' [-fpermissive] StringList.h #include #pragma once using
I keep getting an error how do I fix this error [Error] invalid conversion from 'int' to 'const char*' [-fpermissive]
StringList.h
#include
using namespace std;
class StringList {
public:
//Default constructor StringList();
//Insert single string parameter and returns a bool bool insert(string a);
//remove a single string parameter void remove(string b);
//retrieve a single string parameter void retrieve(string c);
// returns an integer int size();
};
StringList.cpp
#include
#include
#include "StringList.h"
using namespace std;
//Default constructor StringList::StringList(){
}
//Insert a string bool StringList::insert(string a){
return false;
}
//remove a string (has a single integer parameter and returns a string) void StringList::remove(string b){
}
//retrieve a string (has a single integer parameter and returns a string) void StringList::retrieve(string c){
}
//Return a number of value int StringList::size(){
return 0; }
main.cpp
#include
#include
#include "StringList.h"
void exercise1Test() { StringList sList; sList.insert("bob"); string resultString = sList.retrieve(4); resultString = sList.remove(0); cout In this exercise you are to implement the basic structure of a class (related to assignment 1) such that - even though the class methods are not implemented - it will still compile and run. This exercise is intended to illustrate the minimally acceptable standard for assignment submissions. That is, the class and methods meet the requirements for naming, parameter lists and return values described in the assignment and the files are submitted correctly. Requirements 1. Write the class definition of the StringList class in a file named StringList.h. Your class definition should contain the prototypes of the public methods described below. It should not have any private methods or attributes. 2. Write stubs for each of the public methods in a file named StringList.cpp - which should include StringList.h. The default constructor and insert methods should be empty, remove and retrieve should return the empty string('') and size should return zero 3. Submit your StringList.h and StringList.cpp files in a single .zip file with no other folder structure. i.e. your.zip file should contain the two files which should not be contained in another folder. StringList Class Class Description Your class should be named StringList and should have the following public methods: default constructor (i.e. with no parameters) insert - has a single string parameter remove - has a single integer parameter and returns a string retrieve- has a single integer parameter and returns a string size - returns an integer Notes The calling object should be made constant for any method where the calling object's attribute values should not change. Method parameters and return values are noted in the method descriptions - you must not add additional parameters to the methods; if the method description does not mention a parameter it does not have one, similarly if no return value is mentioned the method is void (or a constructor or destructor). Methods must be given the same names as shown above. As described above under requirements your methods should be stubs - either empty if void or returning a default value otherwise. You should not implement their assumed functionality. There is no copy constructor, overloaded assignment operator or destructor specified for this class, which you would normally expect. This is intended to reduce the amount of work for this first exercise. Class Files Your class should consist of a header file called StringList.h that contains the class definition and an implementation file called StringList.cpp that contains the method stubs. Stubs What is a Stub Function? A function that does not contain the intended implementation but still allows the function to be called in a program. Stub functions that return values return some default value, such as 0. min D o main.cpp StringList.h StringList.cpp 1 #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started