I am getting these errors when running my code:  Artist.cpp:28:9: error: no declaration matches ‘void Artist::printInfo() const’ 28 | void Artist::printInfo() const{ | ^~~~~~ Artist.cpp:28:9: note: no functions named ‘void Artist::printInfo() const’ In file included from Artist.cpp:1: Artist.h:7:7: note: ‘class Artist’ defined here 7 | class Artist{ | ^~~~~~ Artwork.cpp:22:9: error: no declaration matches ‘void Artwork::printInfo()’ 22 | void Artwork::printInfo(){ | ^~~~~~~ Artwork.cpp:22:9: note: no functions named ‘void Artwork::printInfo()’ In file included from Artwork.cpp:2: Artwork.h:8:7: note: ‘class Artwork’ defined here 8 | class Artwork{ | ^~~~~~~   Artist.cpp code:  #include "Artist.h" #include #include using namespace std; Artist::Artist(){ artistName = "None"; birthYear = 0; deathYear = 0; } Artist::Artist(string artistName, int birthYear, int deathYear){ this->artistName = artistName; this->birthYear = birthYear; this->deathYear = deathYear; } string Artist::GetName() const{ return artistName; } int Artist::GetBirthYear() const{ return birthYear; } int Artist::GetDeathYear() const{ return deathYear; } void Artist::printInfo() const{ cout << "Artist: " << artistName; if (deathYear != 1 ) cout << " ( " << birthYear << " - " << deathYear << " ) " << endl; else cout << ", born " << birthYear << endl; }   Artist.h code:  #ifndef ARTISTH #define ARTISTH #include using namespace std; class Artist{ public: Artist(); Artist(string artistName, int birthYear, int deathYear); string GetName() const; int GetBirthYear() const; int GetDeathYear() const; void PrintInfo() const; private: string artistName; int birthYear; int deathYear; }; #endif

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am getting these errors when running my code: 

Artist.cpp:28:9: error: no declaration matches ‘void Artist::printInfo() const’ 28 | void Artist::printInfo() const{ | ^~~~~~ Artist.cpp:28:9: note: no functions named ‘void Artist::printInfo() const’ In file included from Artist.cpp:1: Artist.h:7:7: note: ‘class Artist’ defined here 7 | class Artist{ | ^~~~~~ Artwork.cpp:22:9: error: no declaration matches ‘void Artwork::printInfo()’ 22 | void Artwork::printInfo(){ | ^~~~~~~ Artwork.cpp:22:9: note: no functions named ‘void Artwork::printInfo()’ In file included from Artwork.cpp:2: Artwork.h:8:7: note: ‘class Artwork’ defined here 8 | class Artwork{ | ^~~~~~~

 

Artist.cpp code: 

#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;

Artist::Artist(){
artistName = "None";
birthYear = 0;
deathYear = 0;
}

Artist::Artist(string artistName, int birthYear, int deathYear){
this->artistName = artistName;
this->birthYear = birthYear;
this->deathYear = deathYear;
}

string Artist::GetName() const{
return artistName;
}

int Artist::GetBirthYear() const{
return birthYear;
}
int Artist::GetDeathYear() const{
return deathYear;
}
void Artist::printInfo() const{
cout << "Artist: " << artistName;
if (deathYear != 1 )
cout << " ( " << birthYear << " - " << deathYear << " ) " << endl;
else
cout << ", born " << birthYear << endl;
}

 

Artist.h code: 

#ifndef ARTISTH
#define ARTISTH

#include <string>
using namespace std;

class Artist{
public:
Artist();

Artist(string artistName, int birthYear, int deathYear);

string GetName() const;

int GetBirthYear() const;

int GetDeathYear() const;

void PrintInfo() const;

private:
string artistName;
int birthYear;
int deathYear;
};

#endif

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education