#include <iostream>
using namespace std;
class Dog {
private:
string name;
string breed;
int age;
public:
static const double licenseFee;
public:
void setData(string name, string breed, int age);
void display();
};
void Dog::setData(string name, string breed, int age) {
this->name = name;
this->breed = breed;
this->age = age;
}
void Dog::display() {
cout << "Dog's name: " << this->name << ", breed: " << this->breed <<
", age: " << this->age << ", license fee: $" << Dog::licenseFee << endl;
}
const double Dog::licenseFee = 13.45;
int main() {
Dog Bobby;
Dog Daisy;
Dog Cooper;
Bobby.setData("Bobby", "Yorkshire Terrier", 3);
Daisy.setData("Daisy", "Poodle", 1);
Cooper.setData("Cooper", "Labrador Retriever", 5);
Bobby.display();
Daisy.display();
Cooper.display();
}
Comments
Leave a comment