Hiding Members
-
Hello I create a structure (shown below) Public Structure strucAI Public IO As strucIO Public Data As strucData Public System As strucSystems Public Memory As strucMemory Public Learning As strucLearning Public Operations As strucOperations Public Programming As strucProgramming End Structure And I define a variable AI as the structure Public AI As strucAI But the problem is : i want to hide members which are; AI.GetType() AI.Equals() AI.GetHashCode() AI.ToString() Is there any way to do that? Thank you for your time Regards Best Regards Emre YAZICI
-
Hello I create a structure (shown below) Public Structure strucAI Public IO As strucIO Public Data As strucData Public System As strucSystems Public Memory As strucMemory Public Learning As strucLearning Public Operations As strucOperations Public Programming As strucProgramming End Structure And I define a variable AI as the structure Public AI As strucAI But the problem is : i want to hide members which are; AI.GetType() AI.Equals() AI.GetHashCode() AI.ToString() Is there any way to do that? Thank you for your time Regards Best Regards Emre YAZICI
Since all data types in NET derive ultimatelly from the Object data type and the GetType(), Equals(), GetHashCode(), ToString() are members of Object, these methods can not be hidden:(, they can only be overriden. In your case, it would be interesting to override the ToString() method to display a custom text representation of your struct.