int main() { Dog x; x.setName("Lerothodi"); x.setAge(5); x.setWeight(60); x.setBreed("German Shepherd"); cout << "Name : " << x.getName() << endl; cout << "Age : " << x.getAge() << " years." << endl;; cout << "Weight : " << x.getWeight() << " lb." << endl; cout << "Breed : " << x.getBreed() << endl; cout << "Lifespan: " << x.getLifespan() << endl; cout << endl; Pet y; y.setName("Leeuw"); y.setAge(7); y.setWeight(55); cout << "Name : " << y.getName() << endl; cout << "Age : " << y.getAge() << " years." << endl;; cout << "Weight : " << y.getWeight() << " lb." << endl; cout << "Lifespan: " << y.getLifespan() << endl; return 0; }
void QT1::listItemChanged() { int idx = this->getRepoListSelectedIndex(); if (idx == -1) return; std::vector<Dog> dogs = this->currentDogsInRepoList; if (idx > dogs.size())return; Dog s = dogs[idx]; this->nameEdit->setText(QString::fromStdString(s.getName())); this->breedEdit->setText(QString::fromStdString(s.getBreed())); QString w; w.setNum(s.getAge()); this->ageEdit->setText(w); this->linkEdit->setText(QString::fromStdString(s.getPhotograph())); }