Recent

Author Topic: convert inherited; to inherited create(nil);  (Read 4768 times)

WarLock

  • Guest
convert inherited; to inherited create(nil);
« on: November 10, 2005, 04:16:54 am »
hi all
like the subject i ihave this portion of code to convert to lazarus

this code work in delphi

Code: [Select]
procedure TODERagdollBone.Stop;
begin
  inherited;
  dBodyDestroy( FBody );
  if Assigned( FGeom.data ) then
  begin
    FRagdoll.GLSceneRoot.Remove( TGLBaseSceneObject( FGeom.data ), false );
  end;
  dGeomDestroy( FGeom );
end;          


so i convert it to

Code: [Select]
procedure TODERagdollBone.Stop;
begin
  inherited create(nil);
  dBodyDestroy( FBody );
  if Assigned( FGeom.data ) then
  begin
    FRagdoll.GLSceneRoot.Remove( TGLBaseSceneObject( FGeom.data ), false );
  end;
  dGeomDestroy( FGeom );
end;          


this is right to convert like this
thanks
Warlock

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: convert inherited; to inherited create(nil);
« Reply #1 on: November 10, 2005, 07:05:26 am »
I do not think so. inherited is not calling the Create-method from its parent class but the Stop-method. Most probably this object is derived from some other object which has a Stop-method defined as overidable. So if inherited on its own is not accepted by the compiler, you might change this line to
Code: [Select]
inherited stop;
If the Stop-method is the destructor of your object, you should place the inherited-statement as the last statement in your procedure. But all this is a bit hard to say if I have to go only by the pieces of code you have given.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

WarLock

  • Guest
glscene latest package + oxGLODE
« Reply #2 on: November 10, 2005, 07:59:02 pm »
Quote
If the Stop-method is the destructor of your object, you should place the inherited-statement as the last statement in your procedure. But all this is a bit hard to say if I have to go only by the pieces of code you have given.


i understand and it's why i put online the package thati'm trying to compile.It's Glscene for lazarus thats work reasonably + oxGLODE from Dave Gravel.

you can download at http://www.hybride.ca/union/upload/public/File/glscene.zip  [17,5 m]

I'm sure it's prety simple to make it's compile if some pro help me :)

Thanks
WarLock