Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Abstract Classes
Message
 
À
29/03/1997 06:54:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00026135
Message ID:
00026140
Vues:
31
You need to define your primary key routine as a method (PrimaryKey) in your class that returns the value of the primary key. To use the class do

oClass = CREATE OBJECT("Business")
keyval = oClass.PrimaryKey()

>I am trying to follow the advice from an article I read in FoxPro Advisor and need some help. I am trying to create a library for my business rules (BUSINESS.VCX). The first class I want to create is PrimaryKey, a simple routine to generate a random number to serve as a primary key for any table. I created a custom class PrimaryKey with a property called PrimaryKey and a method called GenerateKey. GenerateKey is as follows:
>*******
>LOCAL nPrimaryKey
>
>nPrimaryKey = INT(1000000 * RAND(-1) )
>THIS.PrimaryKey = nPrimaryKey
>*******
>
>Is there a better way to handle this? If not, how do I call the class and get a return value? I just can't quite get the hang of this OOP thing . . . .
>
>TIA.
>
>John
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform