it's friday

This commit is contained in:
2022-03-18 10:45:12 -05:00
parent 3f0681c981
commit 49ea46b506
3 changed files with 15 additions and 6 deletions

View File

@@ -58,6 +58,11 @@ char& Dog::operator[](int index){
return name[index];
}
Dog Dog::puppy(int namelength, char * name){
Dog p(0, namelength, name);
return p;
}
ostream& operator<<(ostream& os, const Dog& d){
for(int i = 0; i< d.namelength; i++) {
os << d[i];

View File

@@ -3,6 +3,8 @@ using namespace std;
class Dog {
public:
Dog(int age, int namelength, char * name);
// has to be dog object, not reference
static Dog Dog::puppy(int namelength, char *name);
Dog(const Dog& from);
~Dog();
Dog& operator=(const Dog& rhs);