6 Replies - 306 Views - Last Post: 31 July 2013 - 05:19 AM Rate Topic: -----

#1 zerophase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 07-May 13

[Smalltalk] What does the * operator mean in this context.

Posted 30 July 2013 - 12:06 PM

I'm looking for what the * means in the below example. MapSite class shows up in the Room class, (Which inherits from MapSite)but MapSite doesn't have a GetSide method, only Room has that method. Does the * add the GetSide method to MapSite?
MapSite* GetSide(Direction) const; 

Is This A Good Question/Topic? 0
  • +

Replies To: [Smalltalk] What does the * operator mean in this context.

#2 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2017
  • View blog
  • Posts: 3,046
  • Joined: 21-June 11

Re: [Smalltalk] What does the * operator mean in this context.

Posted 30 July 2013 - 12:43 PM

That's not Smalltalk code, it's C++ code. And the * means "pointer".
Was This Post Helpful? 1
  • +
  • -

#3 zerophase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 07-May 13

Re: [Smalltalk] What does the * operator mean in this context.

Posted 30 July 2013 - 01:02 PM

View Postsepp2k, on 30 July 2013 - 12:43 PM, said:

That's not Smalltalk code, it's C++ code. And the * means "pointer".

Thanks for the quick reply.

Would
 MapSite.GetSide(Direction)
be the equivalent for C#?
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2017
  • View blog
  • Posts: 3,046
  • Joined: 21-June 11

Re: [Smalltalk] What does the * operator mean in this context.

Posted 30 July 2013 - 03:47 PM

No, MapSite* GetSide(Direction foo) { ... } would be the closest equivalent with the caveat that C# has no equivalent for const and that the declaration and the definition of a method are not separate in C#.
Was This Post Helpful? 0
  • +
  • -

#5 zerophase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 07-May 13

Re: [Smalltalk] What does the * operator mean in this context.

Posted 30 July 2013 - 05:39 PM

So, if I wanted to do something similar would I just use an interface? I'm trying to stay out of programming in unsafe mode if possible.
Was This Post Helpful? 0
  • +
  • -

#6 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2017
  • View blog
  • Posts: 3,046
  • Joined: 21-June 11

Re: [Smalltalk] What does the * operator mean in this context.

Posted 31 July 2013 - 04:57 AM

Are you trying to port a C++ application to C#? Then you'd probably just leave out the pointer. Using a C# reference instead of a pointer is probably sufficient (but of course I have no idea how the method is going to be used). And no, knowing only what you told me, I see no reason why you'd use an interface. Note that method is not declared as abstract (that would be done with `= 0` in C++), so it does have a definition somewhere.
Was This Post Helpful? 0
  • +
  • -

#7 zerophase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 07-May 13

Re: [Smalltalk] What does the * operator mean in this context.

Posted 31 July 2013 - 05:19 AM

I'm working through the GOF book using C#, and I just want to avoid making a decision early on that might make later steps in their examples unbearably difficult.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1