qfedu-cpp-level/day3/homework/h2.cpp

28 lines
365 B
C++

#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
class Color
{
private:
int r, g, b;
public:
explicit Color(int r, int g = 0, int b = 0) : r(r), g(g), b(b)
{
}
void show()
{
cout << r << "," << g << "," << b << endl;
}
};
int main()
{
Color c = Color(2, 3, 4);
c.show();
return 0;
}