Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Cat {
- int EyeColor[3];
- string name;
- void say(){
- cout << "My name is " << name << endl;
- }
- void setName (string new_name){
- name = new_name;
- }
- void setEyeColor (int r, int g, int b){
- eyeColor[2] = b;
- eyeColor[1] = g;
- eyeColor[0] = r;
- }
- string getName(){
- return name;
- }
- int getEyeColor (int index){
- return eyeColor [index];
- }
- };
- int main()
- {
- Cat c1;
- c1.setName("Bonnie");
- c1.setEyeColor(0,0,255);
- cout << c1.getName();
- int r = c1.getEyeColor(0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement