Could you help me solve the qusetion? USing C++. Thanks! Create a class (named:
ID: 3702323 • Letter: C
Question
Could you help me solve the qusetion? USing C++. Thanks!
Create a class (named: Drawing) with a default constructor, a constructor with parameters for each data member, and the following private data members: Question 8 year, which is an integer value (initialize to 1800 in the default constructor). Not answered Mark 0.00 out of 10.00 title, which is a string (initialize to empty string in the default constructor). artist, which is a string (initialize to empty string in the default constructor). Your second constructor should take all data member variables as input in the order they are specified above. You only need to write the class definition and any code that is required for that class. Place all code within the class definition. Answer: (penalty regime: 0 %) Flag questionExplanation / Answer
#include<iostream>
using namespace std;
class Drawing
{
int year;
string title;
string artist;
public:
// default constructor
Drawing()
{
this->year = 1800;
this->title = "";
this->artist = "";
}
// constructor
Drawing(int year, string title, string artist)
{
this->year = year;
this->title = title;
this->artist = artist;
}
// getter methods
int getYear()
{
return this->year;
}
string getTitle()
{
return this->title;
}
string getArtist()
{
return this->artist;
}
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.