Skip to content

Instantly share code, notes, and snippets.

@mhassanist
Created January 12, 2021 07:27
Show Gist options
  • Save mhassanist/40ff969adbb6c6a4e8021eacda5edbb1 to your computer and use it in GitHub Desktop.
Save mhassanist/40ff969adbb6c6a4e8021eacda5edbb1 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
class Dog
{
string name;
int licenseNumber;
public:
void setName(string nameIn);
void setLicenseNumber(int licenseNumberIn);
string getName();
int getLicenseNumber();
void printInfo();
};
void Dog::setName(string nameIn)
{
name = nameIn;
}
void Dog::setLicenseNumber(int licenseNumberIn)
{
licenseNumber = licenseNumberIn;
}
string Dog::getName()
{
return name;
}
int Dog::getLicenseNumber()
{
return licenseNumber;
}
void Dog::printInfo()
{
cout<<name<<" "<<licenseNumber;
}
int main()
{
Dog dog1, dog2;
dog1.setName("Trixie");
dog2.setName("Kali");
dog1.setLicenseNumber(1234);
dog2.setLicenseNumber(5678);
dog1.printInfo();
cout<<"\n";
dog2.printInfo();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment