Solved

Pass pointers as parameters.

Posted on 2002-04-02
2
145 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now