Results 1 to 10 of 14

Thread: Arkanoid port (C)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Quote Originally Posted by Ñuño Martínez View Post
    I think that's a bad idea: " destructor Destroy; reintroduce;". You should use "DESTRUCTOR Destroy; OVERRIDE;". Destructor should be virtual always. Note that compiler might do some magic with constructor and destructor (I.e. calling parent constructor or destructor if you forgot to call them). I'm not sure if reintroducing the destructor broke that magic, but I don't like to play that way.

    BTW, good idea to use ARRAY instead of pointer to store lists. Pointers can be used in Pascal almost like in C, but dynamic arrays are much better.
    I thought that 'reintroduce' was roughly the same until I read the wiki about it, so it's already changed I'm still learning the syntax and I do get alot of errors when I forget to use ':=' when assigning, or '==' when comparing, but overall I do see that Pascal has it's advantages.

    Quote Originally Posted by de_jean_7777
    For someone getting introduced to a language it's ambitious, but then again that's how I would've done it. First get it functional, then you can improve on it. Not sure what the rest of the code is but I see a
    Code:
    PArkanoid = ^TArkanoid;

    in the code, and this could probably also be replaced by a class. If it's already a class, then you don't need the PArkanoid type, as a object reference is already a pointer of sorts, so ArkGame can be of type TArkanoid, just assign it your main TArkanoid instance.
    That was added just to the snippet just so it would be clear what the 'ArkGame: PArkanoid' field was refering to, not in actual source Again, the wiki told me that TArkanoid is already a pointer to a class object, so it's left out in the 'real' code. 'Learning by doing' produces alot of interesting errors, warnings and hints...
    Last edited by Rickmeister; 30-03-2016 at 09:19 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •