// THIS FILE IS EMPTY ----
#include "Dog.h"
Dog::Dog(std::string name1, int age1){
name = name1;
age = age1;
}
========================================
/* exercise.cpp */
#ifndef __DOG_H__
#define __DOG_H__
#include <string>
using namespace std;
class Dog {
private:
string name;
int age;
public:
//---- WRITE YOUR OVERLOADED CONSTRUCTOR BELOW THIS LINE
Dog();
Dog(string name1, int age1);
//---- WRITE YOUR OVERLOADED CONSTRUCTOR ABOVE THIS LINE
string get_name() {return name; }
void set_name(string n) {name = n; }
int get_age() {return age; }
void set_age(int a) { age = a;}
int get_dog_years() { return age * 7; }
string speak() { return "Woof";}
};
#endif
沒有留言:
張貼留言