language: C++ 4.7.2 (gcc-4.7.2)
date: 164 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <string>
#include <iostream>
 
using namespace std;
 
 
class Cat{
    private :
        string m_name;
        string m_owner;
        int m_price;
        string m_color;
        double m_weight;
        void sellCat(string whoBought,int price);
    public :
        Cat(); //this is the default constructor notice no arguments
        Cat(const string name , const string color, int price, double weight, const string owner);
        void changeColor(string newColor);
        void setName(string name);
        void showCat();
};
 
 
Cat::Cat(const string name , const string color, int price = 0 , double weight = 0, const string owner = "NotSoldYet"){
    m_name = name;
    m_owner = owner;
    m_color = color;
    m_price = price ;
    m_weight = weight;
}
 
void Cat::showCat()
{
  cout << "Name is " << m_name << endl << "Owner is " << m_owner;
  
}
 
 
 
int main()
{
  Cat newCat("Garfield","Green"); 
  newCat.showCat();
  
}