Hi all,
yestarday I had an annoying problem with Kylix 3 at work and decided
to try if this happens in Lazarus. The situation is the following :
------------------------------------------------------------------------
  { TBaseObject - a base class (3rd party component) }

  TBaseObject = class (TObject)
    protected
      FObject : TObject;
    public
      constructor Create;
      destructor  Destroy; override;
  end;
  
  { TPubObject  - my own class that has a public property to access the data
    object from the parent class.}

  TPubObject = class (TBaseObject)
    public
      procedure Foo;
      property Obj : TObject read FObject;
  end;
--------------------------------------------------------
When I pressed Ctrl+Shift+C to get

procedure TPubObject.Foo;
begin

end;

The procedure body was created but there was added and the following declaration
  TPubObject = class (TBaseObject)
// diff ---------------------------------------
    private
      FObject: TObject;
// diff ---------------------------------------
    public
      procedure Foo;
      property Obj : TObject read FObject;
  end;
----------------------------------------------------------

On Kylix that compiles and runs without errors and when you execute
MyObject.Obj.DoSomething  you get an access violation because Obj = nil.
It reads Self.FObject not ParentClass.FObject.

On Lazarus this happens too, but result in compilation error :
'duplicate identifier FObject'

Is this a bug in code completion or a setting ? If yes where to report it ?
Can code complete check the data members in the base class and decide
what to do or even better ask you what to do (some settings required
perhaps)?

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to