#include <iostream.h>
class A {
int no;
public:
A();
A(int n);
void output(void);
};
A::A()
{
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
A aa;
public:
B();
B(char c, int n);
void output(void);
};
B::B()
{
}
B::B(char c, int n):aa(n) //명시적 콜론 초기화
{
ch= c;
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
------------------------------------------- ----------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
A(int n);
void output(void);
};
A::A()
{
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
A aa;
public:
B();
B(char c, int n);
void output(void);
};
B::B()
{
}
B::B(char c, int n):aa(n), ch(c) //명시적 콜론 초기화
{
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
-----------------------------------------------------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
A(int n);
void output(void);
};
A::A()
{
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
A aa;
public:
B();
B(char c, int n);
void output(void);
};
B::B()
{
}
B::B(char c, int n):aa() //안 적으면 묵시적으로 요렇게 붙음.
{
ch = c;
aa = A(n); //임시객체를 생성함.
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
생성자 불러서 초기화 //권하지 않음. 쓸대없는 임시 오프젝트가 만들어짐.
-----------------------------------------------------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
~A();
A(int n);
void output(void);
};
A::A()
{
}
A::~A()
{
cout << "A distructor" << endl;
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
A aa;
public:
B();
~B();
B(char c, int n);
void output(void);
};
B::B()
{
}
B::~B()
{
cout << "B distructor" << endl;
}
B::B(char c, int n):aa(n), ch(c) //명시적 콜론 초기화
{
ch = c;
aa = A(n); //임시객체를 생성함.
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
-----------------------------------------------------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
~A();
A(int n);
void output(void);
};
A::A()
{
}
A::~A()
{
cout << "A distructor" << endl;
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
A aa;
public:
B();
~B();
B(char c, int n);
void output(void);
};
B::B()
{
}
B::~B()
{
cout << "B distructor" << endl;
}
B::B(char c, int n):aa(n), ch(c) //명시적 콜론 초기화
{
ch = c;
aa = A(n); //임시객체를 생성함.
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
-----------------------------------------------------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
~A();
A(int n);
void output(void);
};
A::A()
{
}
A::~A()
{
cout << "A distructor" << endl;
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
char &rch;
A aa;
public:
B();
~B();
B(char c, int n);
void output(void);
};
B::B():rch(ch)
{
}
B::~B()
{
cout << "B distructor" << endl;
}
B::B(char c, int n):aa(n), ch(c), rch(ch) //명시적 콜론 초기화
{
ch = c;
aa = A(n); //임시객체를 생성함.
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
-----------------------------------------------------------------------------
#include <iostream.h>
class A {
int no;
public:
A();
~A();
A(int n);
void output(void);
};
A::A()
{
}
A::~A()
{
cout << "A distructor" << endl;
}
A::A(int n)
{
no = n;
}
void A::output(void)
{
cout << no << endl;
}
class B {
char ch;
char &rch;
A aa;
public:
B();
~B();
B(char c, int n);
void output(void);
};
B::B():rch(ch)
{
}
B::~B()
{
cout << "B distructor" << endl;
}
B::B(char c, int n):aa(n), ch(c), rch(ch) //명시적 콜론 초기화
{
ch = c;
aa = A(n); //임시객체를 생성함.
}
void B::output(void)
{
cout << ch;
aa.output();
}
void main(void)
{
B bb;
bb.output();
}
중뷁~
피드 구독하기:
댓글 (Atom)
대학원생의 투고 지도 ④ (완결) — 논문의 수준이란 무엇인가: 사다리와 사분위, 첫 논문 전략
완결편이다. "논문 수준"이라는 말을 해부하고, 에듀테크 석사생의 첫 논문 전략으로 마친다. 학위논문과 학술지 논문은 다른 장르다 먼저 가장 흔한 혼동부터. 학위논문(thesis)은 "내가 연구를 수행할 줄 안다...
-
오늘 테스트 해보고 포스팅 한다. 인터넷을 통해서 현대 오토넷 리얼뷰를 구입했다. 인터넷 보니 천차만별이던데 기본 25만원 하더라. 그런데 2가지가 있었다. 고급형은 HD에 2채널 25만원. 내가 산건 HD 아니고 1채널이...
-
프루나는 이제 믿을만한 공유가 안되고 있다. 젠장. 영화 다운 받아보면 전부 야동이나 포르노류 밖에는 없다. 신고되어 있는 자료부터 보지만 신고가 안되어 있는 것은 제대로 다운도 되지 않는다. 이젠 유료 사이트를 믿을 수 밖엔... ...
-
소스는 쉬어 가는 페이지 인가... SELinux에서 SEAndroid가 나왔다. 둘다 NSA 프로젝트이고. 이미 여러 패키지에 흩어져서 사용되고 있다. policycoreutils는 tresys에서 만든 것으로 보인다. ...
댓글 없음:
댓글 쓰기
국정원의 댓글 공작을 지탄합니다.