0

Hi gang,

I've created an object array from a managed class.

array<MyDataType_Class^> ^Object = gcnew array <MyDataType_Class^> (3);
 Object[1] = gcnew MyDataType_Class;
 Object[1]->id = 1; 
 Object[1]->surnmame = "Formen"; 
 
  TextBox1->AppendText(ConvertToString(Object[1]->surname));  // Outputs "Formen"  +

The object works well and outputs expected results. However what i need is :
Calling or using this data type in some other custom functions

Thanks.

PS. referred class

public ref class MyDataType_Class // managed class
{
public:
    int id;
    String ^surnmame; 

    MyDataType_Class() : id(0),surname(""){}
}
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by cangan
0

I haven't gotten into CLR C++ yet, but I'll take my best shot.

MyDataType_Class ^myFunction(String someName="",int someID=0){
    MyDataType_Class ^new Person=gcnew MyDataType_Class();
    Person->id=someID * 2; //Multiply by 2 just because
    Person->name=someName;
    return Person;
}

.
.
.


void SomeOtherFunction(){
    MyDataType_Class ^thisPerson=myFunction("Runcible Spoon", 21);
.
.
.
}

Edited by DeanMSands3: n/a

0

I haven't worked it out yet. Please give me some link to look into it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.