C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[37062] Re:C++에 대하여 질문....
이현진 [cyberpd] 694 읽음    2004-09-01 09:24
김상면 님이 쓰신 글 :
: 생성자에서 아래와 같은 코딩은 어떤 의미인가요
: this = malloc(.....)
:
: 정말 C++어렵습니다. 산넘어 산이군요
: 그럼

클래스 안에서 객체의 주소를 가지는 this 포인터는 lvalue가 될 수 없습니다.
아마도 잘못된 코드같습니다.

[ISO/IEC 14882-1998 Programming Language C++]
9.3.2 The this pointer

1 In the body of a nonstatic (9.3) member function, the keyword this is
  a nonlvalue expression whose value is the address of the object for
  which the function is called. The type of this in a member function
  of a class X is X*. If the member function is declared const,
  the type of this is const X*, if the member function is declared volatile,
  the type of this is volatile X*, and if the member function is declared
  const volatile, the type of this is const volatile X*.

c++에서 객체에 생성은 new 연산자를 통해 합니다.
malloc은 C 기반 라이브러리로 객체에 생성에 사용하면 어떠한 문제점이 있다고 하던데.. .잊어버렸습니다. =ㅈ=;

+ -

관련 글 리스트
37044 C++에 대하여 질문.... 김상면 712 2004/08/30
37062     Re:C++에 대하여 질문.... 이현진 694 2004/09/01
37110         Re:Re:C++에 대하여 질문.... 김상면 644 2004/09/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.