Solved

Pass pointers as parameters.

Posted on 2002-04-02
2
150 Views
Last Modified: 2010-04-04
Hi again experts!

I want to make a function which executes an SQL sentence on any existing TQuery component. I'm attempting to pass a pointer to the TQuery object as a parameter, but the compiler gives me an error at the function prototype:
"Identifier expected but '^' found".
Here is the code:

type
 TServeis = class(TObject)
 private
  { Private declarations }
  prova: ^TQuery; //this line compiles correctly
 public
  function BDEToStringList(Sentencia,Camp: String;var Llista: TStringList): Boolean;
  function Cerca(Sentencia,Camp: String):Variant;
  function ManipulaQ(Sentencia: TStrings;PQ: ^Integer):Integer; //error
  function ConsultaQ(Sentencia: TStrings;PQ: ^TQuery):Integer; //error
 end;

Any ideas are welcome! Thank you!
0
Comment
Question by:Kurtis
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 75 total points
ID: 6913554
as every tobject is a pointer to itself,
you don't need the ^-sign

type
TServeis = class(TObject)
private
 { Private declarations }
 prova: TQuery; //this line compiles correctly
public
 function BDEToStringList(Sentencia,Camp: String;var Llista: TStringList): Boolean;
 function Cerca(Sentencia,Camp: String):Variant;
 function ManipulaQ(Sentencia: TStrings;PQ: ^Integer):Integer; //don't know for what this may be
 function ConsultaQ(Sentencia: TStrings;PQ:  TQuery):Integer; //error
end;

meikl ;-)
0
 

Author Comment

by:Kurtis
ID: 6913587
It was pretty simple.
Thanks kretzschmar!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question