Index: /trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/Compile_CallProc.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/Compile_CallProc.cpp	(revision 350)
@@ -156,5 +156,5 @@
 		/////////////////////////////////
 		pMethod = NULL;
-		if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOfInterfaceMethod( pUserProc );
+		if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOrInterfaceMethod( pUserProc );
 		if( ! pMethod ){
 			//動的メソッドが取得できなかったときは静的メソッドを当たる
@@ -280,5 +280,5 @@
 		//////////////////////////////////////////////////////
 		// メンバ関数の場合
-		// ※_System_LocalThis パラメータをセット
+		// ※_System_LocalThis パラメータをecxにセット
 		//////////////////////////////////////////////////////
 
@@ -319,15 +319,8 @@
 			}
 		}
-
-		//push ecx
-		compiler.codeGenerator.op_push(REG_ECX);
-	}
-
-	if( pUserProc->IsVirtual() && !isFixedClass ){
-		//仮想関数（オブジェクトメソッド）呼び出し
-		//pObj->func_table->func1
-		//                ->func2
-		//                ->func3
-
+	}
+
+	if( pUserProc->IsVirtual() && !isFixedClass )
+	{
 		int vtblIndex;
 		if( pobj_c->IsInterface() )
@@ -347,5 +340,5 @@
 
 			// インターフェイスの場合は更に__thisを取得する
-			//mov rcx,qword ptr[rcx+offset_this]
+			//mov ecx,qword ptr[ecx+offset_this]
 			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_ECX, offset_this, MOD_BASE_DISP8 );
 
@@ -376,6 +369,9 @@
 			// vtblのポインタを取得
 			//mov edx,dword ptr[edx+vtblMasterListIndex]
-			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex, MOD_BASE_DISP32 );
-		}
+			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex*PTR_SIZE, MOD_BASE_DISP32 );
+		}
+
+		//push ecx
+		compiler.codeGenerator.op_push(REG_ECX);	
 
 		//call dword ptr[edx+func_index]
@@ -399,4 +395,10 @@
 		//通常呼び出し
 
+		if( pUserProc->GetParentClassPtr() && isStatic == false )
+		{
+			//push ecx
+			compiler.codeGenerator.op_push(REG_ECX);
+		}
+
 		//call ProcAddr
 		compiler.codeGenerator.op_call(pUserProc);
Index: /trunk/abdev/BasicCompiler32/Compile_Func.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/Compile_Func.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/Compile_Func.cpp	(revision 350)
@@ -315,5 +315,5 @@
 			// vtblのポインタを取得
 			//mov edx,dword ptr[edx+vtblMasterListIndex]
-			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex, MOD_BASE_DISP32 );
+			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex*PTR_SIZE, MOD_BASE_DISP32 );
 		}
 
Index: /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 350)
@@ -258,4 +258,22 @@
 		UserProc::CompileStartForUserProc( pBackUserProc );
 		cp=BackCp;
+	}
+	else if( userProc.HasParentClass()
+		&& userProc.IsCastOperator()
+		&& userProc.ReturnType().IsInterface() )
+	{
+		// インターフェイス型にキャストするためのメソッド
+
+		int vtblMasterListIndex = userProc.GetParentClass().GetVtblMasterListIndex( &userProc.ReturnType().GetClass() );
+
+		char temporary[1024];
+		sprintf( temporary,
+			"Return New %s(ObjPtr( This ),Get_LONG_PTR( (Get_LONG_PTR( ObjPtr(This) ) + SizeOf(LONG_PTR)*%d) As VoidPtr ) As VoidPtr )",
+			userProc.ReturnType().GetClass().GetName().c_str(),
+			vtblMasterListIndex
+		);
+		MakeMiddleCode( temporary );
+
+		ChangeOpcode( temporary );
 	}
 	else{
Index: /trunk/abdev/BasicCompiler32/Compile_Var.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 350)
@@ -1214,5 +1214,9 @@
 
 	//New呼び出し
-	if( type.IsObject() &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){
+	if( type.IsObject()
+		&& !type.IsInterface()
+		&&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0
+		&&InitBuf[0]=='\0')
+	{
 		char objectSize[255];
 		if( subscripts.size() == 0 ){
Index: /trunk/abdev/BasicCompiler32/NumOpe.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/NumOpe.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/NumOpe.cpp	(revision 350)
@@ -232,5 +232,5 @@
 	GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType);
 
-	objClass.EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs );
+	objClass.EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs );
 	if(userProcs.size()){
 		//オーバーロードを解決
@@ -819,5 +819,5 @@
 					|| term[0] == '\"' )
 				{
-					if( baseType.IsObject() || baseType.IsNull() )
+					if( !baseType.IsPointer() )
 					{
 						//要求タイプがオブジェクト、または未定のとき
Index: /trunk/abdev/BasicCompiler32/Opcode.h
===================================================================
--- /trunk/abdev/BasicCompiler32/Opcode.h	(revision 349)
+++ /trunk/abdev/BasicCompiler32/Opcode.h	(revision 350)
@@ -220,5 +220,5 @@
 //OperatorProc.cpp
 void FreeTempObject(int reg,const CClass *pobj_c);
-int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp);
+int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,BOOL *bUseHeap,int &sp);
 void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType);
 void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags = 0 );
Index: /trunk/abdev/BasicCompiler32/OperatorProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/OperatorProc.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler32/OperatorProc.cpp	(revision 350)
@@ -28,8 +28,11 @@
 }
 
-int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){
+int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,BOOL *bUseHeap,int &sp)
+{
+	Type leftType( type_stack[sp-2], index_stack[sp-2] );
+	Type rightType( type_stack[sp-1] & (~FLAG_CAST), index_stack[sp-1] );
+
 	//オーバーロードされたオペレータ関数を呼び出す
-	CClass *pobj_c;
-	pobj_c=(CClass *)index_stack[sp-2];
+	const CClass *pobj_c = &leftType.GetClass();
 
 	std::vector<const UserProc *> subs;
@@ -52,5 +55,5 @@
 
 	if(bTwoTerm){
-		params.push_back( new Parameter( "", Type( type_stack[sp-1], index_stack[sp-1] ) ) );
+		params.push_back( new Parameter( "", rightType ) );
 	}
 
@@ -89,5 +92,5 @@
 	}
 
-	int right_side_size = Type(type_stack[sp-1],index_stack[sp-1]).GetSize();
+	int right_side_size = rightType.GetSize();
 
 	if(bTwoTerm){
Index: /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
===================================================================
--- /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj	(revision 349)
+++ /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj	(revision 350)
@@ -795,24 +795,4 @@
 					>
 					<File
-						RelativePath=".\Compile_Interface.cpp"
-						>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								UsePrecompiledHeader="2"
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								UsePrecompiledHeader="2"
-							/>
-						</FileConfiguration>
-					</File>
-					<File
 						RelativePath=".\Compile_Object.cpp"
 						>
Index: /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 350)
@@ -164,5 +164,5 @@
 		/////////////////////////////////
 		pMethod = NULL;
-		if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOfInterfaceMethod( pUserProc );
+		if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOrInterfaceMethod( pUserProc );
 		if( ! pMethod ){
 			//動的メソッドが取得できなかったときは静的メソッドを当たる
Index: unk/abdev/BasicCompiler64/Compile_Interface.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Interface.cpp	(revision 349)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#include "stdafx.h"
-
-#include "../BasicCompiler_Common/common.h"
-#include "opcode.h"
-
-bool CastToInterface( int reg, int vtblReg, const CClass &baseClass, const CClass &interfaceClass ){
-	return true;
-}
Index: /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 350)
@@ -179,4 +179,22 @@
 		UserProc::CompileStartForUserProc( pBackUserProc );
 		cp=BackCp;
+	}
+	else if( userProc.HasParentClass()
+		&& userProc.IsCastOperator()
+		&& userProc.ReturnType().IsInterface() )
+	{
+		// インターフェイス型にキャストするためのメソッド
+
+		int vtblMasterListIndex = userProc.GetParentClass().GetVtblMasterListIndex( &userProc.ReturnType().GetClass() );
+
+		char temporary[1024];
+		sprintf( temporary,
+			"Return New %s(ObjPtr( This ),Get_LONG_PTR( (Get_LONG_PTR( ObjPtr(This) ) + SizeOf(LONG_PTR)*%d) As VoidPtr ) As VoidPtr )",
+			userProc.ReturnType().GetClass().GetName().c_str(),
+			vtblMasterListIndex
+		);
+		MakeMiddleCode( temporary );
+
+		ChangeOpcode( temporary );
 	}
 	else{
Index: /trunk/abdev/BasicCompiler64/Compile_Var.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Var.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler64/Compile_Var.cpp	(revision 350)
@@ -1226,6 +1226,10 @@
 	}
 
-	//コンストラクタ呼び出し
-	if( type.IsObject() &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){
+	//New呼び出し
+	if( type.IsObject()
+		&& !type.IsInterface()
+		&&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0
+		&&InitBuf[0]=='\0')
+	{
 		char objectSize[255];
 		if( subscripts.size() == 0 ){
Index: /trunk/abdev/BasicCompiler64/NumOpe.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 350)
@@ -233,5 +233,5 @@
 	GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType);
 
-	objClass.EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs );
+	objClass.EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs );
 	if(userProcs.size()){
 		//オーバーロードを解決
@@ -751,4 +751,8 @@
 
 
+	if( strstr(expression,"xxxxx"))
+	{
+		int test=0;
+	}
 
 	////////////////////////////////
@@ -789,11 +793,4 @@
 						// ダウンキャストを許可する
 				}
-				else if( idCalc == CALC_AS
-					&& type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST ) && ((CClass *)index_stack[sp-1])->IsInterface()
-					){
-						// インターフェイスへのキャスト
-						// TODO: 実装
-						CastToInterface( pobj_reg->GetLockingReg(), REG_R15, *(CClass *)index_stack[sp-2], *(CClass *)index_stack[sp-1] );
-				}
 				else{
 					//オーバーロードされたオペレータを呼び出す
@@ -853,5 +850,5 @@
 					|| term[0] == '\"' )
 				{
-					if( baseType.IsObject() || baseType.IsNull() )
+					if( !baseType.IsPointer() )
 					{
 						//要求タイプがオブジェクト、または未定のとき
Index: /trunk/abdev/BasicCompiler64/Opcode.h
===================================================================
--- /trunk/abdev/BasicCompiler64/Opcode.h	(revision 349)
+++ /trunk/abdev/BasicCompiler64/Opcode.h	(revision 350)
@@ -245,7 +245,4 @@
 void SetReg_WholeVariable( const Type &type, RELATIVE_VAR *pRelativeVar,int reg);
 
-//Compile_Interface.cpp
-bool CastToInterface( int reg, int vtblReg, const CClass &baseClass, const CClass &interfaceClass );
-
 //Compile_Object.cpp
 void Operator_New( const CClass &classObj, const char *objectSizeStr, const char *parameter,const Type &baseTypeInfo );
Index: /trunk/abdev/BasicCompiler64/OperatorProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/OperatorProc.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler64/OperatorProc.cpp	(revision 350)
@@ -33,8 +33,11 @@
 }
 
-int CallOperatorProc(BYTE idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){
+int CallOperatorProc(BYTE idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp)
+{
+	Type leftType( type_stack[sp-2], index_stack[sp-2] );
+	Type rightType( type_stack[sp-1] & (~FLAG_CAST), index_stack[sp-1] );
+
 	//オーバーロードされたオペレータ関数を呼び出す
-	CClass *pobj_c;
-	pobj_c=(CClass *)index_stack[sp-2];
+	const CClass *pobj_c = &leftType.GetClass();
 
 	std::vector<const UserProc *> subs;
@@ -56,6 +59,7 @@
 	Parameters params;
 
-	if(bTwoTerm){
-		params.push_back( new Parameter( "", Type( type_stack[sp-1], index_stack[sp-1] ) ) );
+	if(bTwoTerm)
+	{
+		params.push_back( new Parameter( "", rightType ) );
 	}
 
@@ -94,5 +98,5 @@
 	}
 
-	int right_side_size = Type(type_stack[sp-1],index_stack[sp-1]).GetSize();
+	int right_side_size = rightType.GetSize();
 
 	if(bTwoTerm){
Index: /trunk/abdev/BasicCompiler_Common/MakeExe.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/MakeExe.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/MakeExe.cpp	(revision 350)
@@ -11,4 +11,19 @@
 	extern HWND hMainDlg;
 	PostMessage(GetDlgItem(hMainDlg,IDC_PROGRESS),PBM_STEPIT,0,0);
+}
+
+void MakeMiddleCode( char *buffer )
+{
+	// 改行コードをCRLFからLFにする
+	ChangeReturnCode( buffer );
+
+	// コメントを除去
+	DeleteComment( buffer );
+
+	//エスケープシーケンス設定
+	SetEscapeSequenceFormat( buffer );
+
+	//コマンド対応
+	ChangeCommandToCode( buffer );
 }
 
@@ -18,15 +33,5 @@
 	lstrcpy(temp,buffer);
 
-	// 改行コードをCRLFからLFにする
-	ChangeReturnCode(temp);
-
-	// コメントを除去
-	DeleteComment( temp );
-
-	//エスケープシーケンス設定
-	SetEscapeSequenceFormat(temp);
-
-	//コマンド対応
-	ChangeCommandToCode(temp);
+	MakeMiddleCode( temp );
 
 	//最後尾に貼り付け
Index: /trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 350)
@@ -342,5 +342,5 @@
 
 	vector<const UserProc *> userProcs;
-	leftType.GetClass().EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs );
+	leftType.GetClass().EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs );
 	if(userProcs.size()){
 		//オーバーロードを解決
@@ -597,5 +597,4 @@
 	if( expression[0] == '[' ){
 		if( !baseType.IsPointer() ){
-			SetError(1,NULL,cp);
 			return false;
 		}
@@ -716,5 +715,5 @@
 StrLiteral:
 
-					if( baseType.IsObject() || baseType.IsNull() ){
+					if( !baseType.IsPointer() ){
 						//要求タイプがオブジェクト、または未定のとき
 						type_stack[sp]=DEF_OBJECT;
Index: /trunk/abdev/BasicCompiler_Common/common.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/common.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/common.h	(revision 350)
@@ -274,4 +274,5 @@
 //MakeExe.cpp
 void StepCompileProgress(void);
+void MakeMiddleCode( char *buffer );
 void AddSourceCode(const char *buffer);
 void OutputExe(void);
Index: /trunk/abdev/BasicCompiler_Common/hash.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/hash.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/hash.cpp	(revision 350)
@@ -90,5 +90,5 @@
 			else{
 				//動的メソッドから列挙
-				pobj_c->EnumDynamicMethodsOfInterfaceMethods( NestMember, subs );
+				pobj_c->EnumDynamicMethodsOrInterfaceMethods( NestMember, subs );
 			}
 
@@ -105,5 +105,5 @@
 
 		// 動的メソッド
-		compiler.pCompilingClass->EnumDynamicMethodsOfInterfaceMethods( name, subs );
+		compiler.pCompilingClass->EnumDynamicMethodsOrInterfaceMethods( name, subs );
 	}
 
@@ -157,5 +157,5 @@
 	if( pClass ){
 		vector<const UserProc *> userProcs;
-		pClass->EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs );
+		pClass->EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs );
 		if( userProcs.size() == 1 ){
 			return userProcs[0];
Index: /trunk/abdev/BasicCompiler_Common/include/Class.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/Class.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/include/Class.h	(revision 350)
@@ -386,5 +386,5 @@
 
 	void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
-		bool isVirtual, bool isOverride, char *buffer, int nowLine);
+		bool isVirtual, bool isOverride, bool isAutoGeneration, char *buffer, int nowLine);
 
 	//重複チェック
@@ -409,6 +409,6 @@
 	}
 
-	void EnumDynamicMethodsOfInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const;
-	const CMethod *GetDynamicMethodOfInterfaceMethod( const UserProc *pUserProc ) const;
+	void EnumDynamicMethodsOrInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const;
+	const CMethod *GetDynamicMethodOrInterfaceMethod( const UserProc *pUserProc ) const;
 
 	const Methods &GetStaticMethods() const
@@ -494,4 +494,5 @@
 public:
 	void GetVtblMasterListIndexAndVtblIndex( const UserProc *pUserProc, int &vtblMasterListIndex, int &vtblIndex ) const;
+	int GetVtblMasterListIndex( const CClass *pClass ) const;
 	long GetVtblMasterListOffset() const;
 	void GenerateVTableMasterList( const std::vector<long> &vtableMasterList, long &offset );
@@ -513,4 +514,5 @@
 		, pStringClass( NULL )
 		, pObjectClass( NULL )
+		, pInterfaceInfo( NULL )
 	{
 	}
Index: /trunk/abdev/BasicCompiler_Common/include/Procedure.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/Procedure.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/include/Procedure.h	(revision 350)
@@ -323,4 +323,5 @@
 
 	std::string GetFullName() const;
+	bool IsCastOperator() const;
 
 	bool IsVirtual() const;
Index: /trunk/abdev/BasicCompiler_Common/include/Type.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/Type.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/include/Type.h	(revision 350)
@@ -189,4 +189,5 @@
 	bool IsAny() const;
 	bool IsDelegate() const;
+	bool IsInterface() const;
 
 	// オブジェクトや構造体など、メンバを持つ型かどうかを判別する
Index: /trunk/abdev/BasicCompiler_Common/include/option.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/option.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/include/option.h	(revision 350)
@@ -19,14 +19,14 @@
 #ifdef USE_TRACE
 	// オーバーロードに関するログを生成する
-	//#define USE_TRACE_FOR_OVERLOAD
+	#define USE_TRACE_FOR_OVERLOAD
 
 	// モジュールサイズに関するログを生成する
-	#define USE_TRACE_FOR_SIZE
+	//#define USE_TRACE_FOR_SIZE
 
 	// XMLシリアライズに関するログを生成する
-	#define USE_TRACE_FOR_SERIALIZE
+	//#define USE_TRACE_FOR_SERIALIZE
 
 	// ソースコードステップに関するログを生成する
-	#define USE_TRACE_FOR_SOURCECODESTEP
+	//#define USE_TRACE_FOR_SOURCECODESTEP
 #endif
 
Index: /trunk/abdev/BasicCompiler_Common/include/ver.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/ver.h	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/include/ver.h	(revision 350)
@@ -6,6 +6,6 @@
 // バージョン付加文字列
 #ifdef _AMD64_
-#define VER_INFO		"(x64) (rev.351)"
+#define VER_INFO		"(x64) (rev.356)"
 #else
-#define VER_INFO		"(rev.351)"
+#define VER_INFO		"(rev.356)"
 #endif
Index: /trunk/abdev/BasicCompiler_Common/src/Class.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 350)
@@ -449,4 +449,29 @@
 	interfaces.push_back( new ::Interface( &interfaceClass ) );
 
+	// キャストメソッドを追加（内部コードは自動生成すること）
+	{
+		// Function Operator() As ITest
+
+		char temporary[1024];
+		sprintf(temporary,"%c%c%c%c()%c%c%s",
+			1, ESC_FUNCTION,
+			1, ESC_OPERATOR,
+			1, ESC_AS,
+			interfaceClass.GetName().c_str()
+		);
+
+		this->AddMethod(this,
+			Prototype::Public,
+			0,
+			false,			// isConst
+			false,			// isAbstract
+			false,			// isVirtual
+			false,			// isOverride
+			true,			// isAutoGeneration
+			temporary,
+			-1
+		);
+	}
+
 	return true;
 }
@@ -505,5 +530,5 @@
 
 void CClass::AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
-						 bool isVirtual, bool isOverride, char *buffer, int nowLine){
+						 bool isVirtual, bool isOverride, bool isAutoGeneration, char *buffer, int nowLine){
 	int i,i2;
 	char temporary[VN_SIZE];
@@ -522,4 +547,10 @@
 	UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Add( NamespaceScopes(), NamespaceScopesCollection(), buffer,nowLine,isVirtual,pobj_c, (bStatic!=0) );
 	if(!pUserProc) return;
+
+	if( isAutoGeneration )
+	{
+		// コード自動生成
+		pUserProc->ThisIsAutoGenerationProc();
+	}
 
 
@@ -665,5 +696,5 @@
 }
 
-void CClass::EnumDynamicMethodsOfInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const
+void CClass::EnumDynamicMethodsOrInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const
 {
 	// 動的メソッド
@@ -676,5 +707,5 @@
 	}
 }
-const CMethod *CClass::GetDynamicMethodOfInterfaceMethod( const UserProc *pUserProc ) const
+const CMethod *CClass::GetDynamicMethodOrInterfaceMethod( const UserProc *pUserProc ) const
 {
 	// 動的メソッド
@@ -687,4 +718,8 @@
 		{
 			result = pInterface->GetDynamicMethods().GetMethodPtr( pUserProc );
+			if( result )
+			{
+				return result;
+			}
 		}
 	}
@@ -854,4 +889,21 @@
 	SetError();
 	return;
+}
+int CClass::GetVtblMasterListIndex( const CClass *pClass ) const
+{
+	int result = 0;
+
+	BOOST_FOREACH( const ::Interface *pInterface, interfaces )
+	{
+		result++;
+		
+		if( &pInterface->GetClass() == pClass )
+		{
+			return result;
+		}
+	}
+
+	SetError();
+	return 0;
 }
 long CClass::GetVtblMasterListOffset() const
@@ -1428,9 +1480,10 @@
 				pobj_c->AddMethod(pobj_c,
 					Prototype::Public,	//Publicアクセス権
-					0,					//Static指定なし
-					false,				//Constではない
-					1,					//Abstract
-					1,					//Virtual
-					0,
+					0,					// bStatic
+					false,				// isConst
+					true,				// isAbstract
+					true,				// isVirtual
+					false,				// isOverride
+					false,				// isAutoGeneration
 					temporary,
 					sub_address
@@ -1719,4 +1772,5 @@
 						isVirtual,
 						isOverride,
+						false,
 						temporary,
 						sub_address);
@@ -1946,5 +2000,5 @@
 		}
 
-		pCompilingMethod = pParentClass->GetDynamicMethodOfInterfaceMethod( pUserProc );
+		pCompilingMethod = pParentClass->GetDynamicMethodOrInterfaceMethod( pUserProc );
 		if( !pCompilingMethod ){
 			pCompilingMethod = pParentClass->GetStaticMethods().GetMethodPtr( pUserProc );
Index: /trunk/abdev/BasicCompiler_Common/src/Procedure.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/Procedure.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/src/Procedure.cpp	(revision 350)
@@ -24,4 +24,12 @@
 
 	return GetName();
+}
+bool UserProc::IsCastOperator() const
+{
+	if( GetName()[0] == 1 && GetName()[1] == ESC_OPERATOR && GetName()[2] == CALC_AS )
+	{
+		return true;
+	}
+	return false;
 }
 const NamespaceScopes &UserProc::GetNamespaceScopes() const
Index: /trunk/abdev/BasicCompiler_Common/src/Type.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/Type.cpp	(revision 349)
+++ /trunk/abdev/BasicCompiler_Common/src/Type.cpp	(revision 350)
@@ -211,8 +211,4 @@
 	if( IsObject() )
 	{
-		if( GetClass().IsInterface() ){
-			// vtblOffsetのサイズを含める
-			return PTR_SIZE*2;
-		}
 		return PTR_SIZE;
 	}
@@ -298,4 +294,9 @@
 bool Type::IsPointer( int basicType )
 {
+	if( basicType == DEF_NON )
+	{
+		return false;
+	}
+
 	if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
 		|| ( basicType & FLAG_PTR ) ){
@@ -448,4 +449,9 @@
 	return ( IsObject() && GetClass().IsDelegate() );
 }
+bool Type::IsInterface() const
+{
+	return ( IsObject() && GetClass().IsInterface() );
+}
+
 
 bool Type::HasMember() const
Index: /trunk/abdev/ProjectEditor/Common.h
===================================================================
--- /trunk/abdev/ProjectEditor/Common.h	(revision 349)
+++ /trunk/abdev/ProjectEditor/Common.h	(revision 350)
@@ -66,5 +66,5 @@
 #define APPLICATION_NAME "ActiveBasic 5.0"
 #define VERSION_APPLI_NAME APPLICATION_NAME
-#define VERSION_STRING "5.00.00 (rev.317)"
+#define VERSION_STRING "5.00.00 (rev.356)"
 
 #endif
Index: /trunk/abdev/ProjectEditor/SubOperation.cpp
===================================================================
--- /trunk/abdev/ProjectEditor/SubOperation.cpp	(revision 349)
+++ /trunk/abdev/ProjectEditor/SubOperation.cpp	(revision 350)
@@ -519,4 +519,5 @@
 		if(lstrcmpi(str,"If")==0) return COM_IF;
 		if(lstrcmpi(str,"Imports")==0) return -1;
+		if(lstrcmpi(str,"Implements")==0) return -1;
 		if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS;
 		if(lstrcmpi(str,"Input")==0) return COM_INPUT;
