/*
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
*/
/*
#include <iostream>
using namespace std;
class data {
private:
int a, b, c;
public:
void setA(int x);
int getA();
};
void data::setA(int x) {
if(x < 1000) {
return;
}
a = x;
}
int data::getA() {
return a;
}
int main() {
}
*/
/*
#include<iostream>
#include<string>
using namespace std;
class Point{
int x, y;
public:
void set(int x, int y)
{
this->x = x;
this->y = y;
}
void showPoint()
{
cout << "(" << x << "," << y << ")" << endl;
}
};
class ColorPoint : public Point{
string color;
public:
void setColor(string color)
{
this->color = color;
}
void showColorpoint();
};
void ColorPoint::showColorpoint()
{
cout << color << ":";
showPoint();
}
int main()
{
ColorPoint *pDer;
Point *pBase, po;
pBase = &po;
pDer = (ColorPoint*)pBase;
pDer->set(3,4);
pDer->setColor("Red");
pDer->showColorpoint();
}
*/
/*
#include<iostream>
#include<string>
using namespace std;
class Point{
protected:
int x, y;
public:
void set(int x, int y)
{
this->x = x;
this->y =y;
}
void showPoint()
{
cout << "(" << x << "," << y << ")" << endl;
}
};
class ColorPoint : public Point{
string color;
public:
void setColor(string color)
{
this-> color = color;
}
void showColorpoint();
bool equals(ColorPoint p);
};
void ColorPoint::showColorpoint()
{
cout << color << ":";
showPoint();
}
bool ColorPoint::equals(ColorPoint p)
{
if(x==p.x&&y==p.y&&color==p.color) return true;
else return false;
}
int main()
{
Point p;
p.set(2,3);
p.showPoint();
ColorPoint cp;
cp.set(3,4);
cp.setColor("Red");
ColorPoint cp2;
cp2.set(3,4);
cp2.setColor("Red");
cout << ((cp.equals(cp2))? "true" : "false");
}
*/
/*
#include<iostream>
using namespace std;
class A{
public:
A() {cout << "생성자 A" << endl;}
A(int x){cout << "매개변수생성자 A" << x << endl;}
};
class B : public A{
public:
B(int t):A(t){cout << "생성자 B" << endl;}
};
int main()
{
B b(3);
}
*/
#include<iostream>
#include<string>
using namespace std;
class TV{
int size;
public:
TV() {size = 20;}
TV(int size)
{
this->size = size;
}
int getSize()
{
return size;
}
};
class WideTV : public TV{
bool videoIn;
public:
WideTV(int size, bool videoIn) : TV(size)
{
this->videoIn = videoIn;
}
bool getVideoIn()
{
return videoIn;
}
};
class SmartTV : public WideTV{
string ipAddr;
public:
SmartTV(string ipAddr, int size) : WideTV(size,true)
{
this->ipAddr = ipAddr;
}
string getIpAddr()
{
return ipAddr;
}
};
int main()
{
SmartTV htv("192.0.0.1",32);
cout << htv.getSize() << endl;
cout << boolalpha << htv.getVideoIn() << endl;
cout << htv.getIpAddr() << endl;
}