Book a Demo

Author Topic: specify a method to return a pointer?  (Read 5599 times)

Duc-bert

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
specify a method to return a pointer?
« on: April 17, 2002, 09:55:09 am »
Hi All,

how do I specify a method in my class diagram to return a pointer?

int* getInteger();

Thanks
???

ronnie

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: specify a method to return a pointer?
« Reply #1 on: April 17, 2002, 01:40:03 pm »
It seems the only way to do this is to use the type 'int*' instead of one of the standard ones.

This is what EA does when it imports from source anyway.

Interestingly, attributes have a containment setting that, if set to by reference, generates the '*'.

Maybe there needs to be a 'by reference' parameter passing and return type setting. How this would work in other languages might be interesting.

I guess in this case the type 'int*' should maybe considered a type on it's own. MS certainly think like this and create types like PSTR and PINT etc.

Ronnie
Ronnie

Duc-bert

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: specify a method to return a pointer?
« Reply #2 on: April 17, 2002, 05:16:12 pm »
Thanks ronnie. But this work-around will eliminate the auto update capability of EA. For example,

class MyClass {
...
};

class Creator {

MyClass* createMyClass();

};

anytime I make a modification to MyClass class,  class Create will not see the change. Take this case, I change MyClass name to YourClass name. Now everywhere that I has MyClass*, I have to change it to YourClass*.

This maybe a candiate for future enhancement to EA.
Thanks