2012-12-25 2 views
2

RealBasic의 내성 검사는 내가 예상했던 것과 약간 다릅니다.RealBasic에서 인트로 스페시를 구현하는 방법은 무엇입니까?

내 의도는 다음과 같습니다

다른 개체를 단순화하기 위해, 두 가지, 세 가지 방법을 상속 할에서 MainObject을 만듭니다.

Method 2-> Would call Method1 and with the information, save the child Object.

Method 1-> Returns to the child class itself all of its properties, types and values.

그래서, 방법 1 I는 각 하위 클래스에 대해 쉽게 내가 그 일을하는 방법 2를 위해 필요한 반환 일반화 된 자기 반성을 쓰기에 대해 생각했다.

왜 내가 이것을 원하니? 그래서 저장 방법을 알고있는 수십 개의 객체를 가질 수 있습니다. 속성에 대해 여기저기서 수정하는 것에 대해 너무 걱정하지 않아도됩니다.

그러나 RealBasic 자습서 및 참조 제안이 작동하지 않는 경우를 객체 등의 외부에서 발생하는 것을 요구합니다. 예 : ObjectA의 내부에서 ObjectB의 속성, 메서드 등을 쉽게 얻을 수 있지만 ObjectA, A의 속성은 B가 아닌 내부에 들어가야합니다.

감사합니다. ..

답변

2

나는 아주 간단한 방법으로 MainClass를 만들고 그 내부에 간단한 방법 WhoAmI 배열, 사전 등을 반환 할 수 있습니다 ...

Dim thisClassTypeInfo As Introspection.TypeInfo = Introspection.GetType(Self) 

    Dim thisClassProperties() As Introspection.PropertyInfo = thisClassTypeInfo.GetProperties 

    Dim thisClassMethods() As Introspection.MethodInfo = thisClassTypeInfo.GetMethods 


    For Each myProperty As Introspection.PropertyInfo In thisClassProperties 

// Then here use myProperty.Name, myProperty.Value(Self).StringValue 
// or myProperty.Value(Self).anyotheroption and create a dictionary 
// or array with the results and return it. 

    Next