class Complex
{
public:
Complex()
{
real = 0;
imag = 0;
}
private:
double real;
double imag;
};
class Complex
{
public:
Complex(): real(0),imag(0){}
private:
double real;
double imag;
};
class Complex
{
public:
Complex(double real_= 0, double imag_= 0)
{
real = real_;
imag = imag_;
}
private:
double real;
double imag;
};
class Complex
{
public:
Complex(double real_ = 0, double imag_ = 0) : real(real_),imag(imag_){}
private:
double real;
double imag;
};
class Complex
{
public:
Complex(double real = 0, double imag = 0) : real(real), imag(imag) {}
private:
double real;
double imag;
};
'C,C++' 카테고리의 다른 글
C,C++ : typedef 자료형에(구조체) 새 이름(별명) (0) | 2023.07.31 |
---|---|
C,C++:생성자 위임 (0) | 2023.07.26 |
C,C++: 글래스 구초체 (0) | 2023.07.26 |
C,C++ : using, namespace(std::cout,std::endl) (0) | 2023.07.19 |
C,C++ : 클래스 템플릿 리스트 구현 (0) | 2023.07.19 |