Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Manual class programming example


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Manual class programming example
Date   Wed, 15 Mar 2006 20:27:37 +0100

> Are you skipping the initial periods (. prompts) correctly, but
> incorrectly typing in the numbers (1. and 2. and 3.) after issuing the
> program command? You would not type the numbers (2. and 3.) in the
> following:
> . forv i=1/2 {
>   2. di `i'
>   3. }
> and the same principle applies here. See -help classman- for correct
> syntax.

Yes, I know that, but that is not the problem. I showed you the output of a 
Do-File. The file literally reads as follows:

---------------------------------11.class
version 9
class coordinate {
       double x
       double y
}

program .set
      args x y
      .x = `x'
      .y = `y'
end
-------------------------------------

I than run this file interactively with

. do 11.class

an tried afterwards

. .coord = .coordinate.new
. .coord.set 1 2

The second command brings up the error message in question.

Note that 

. .coord.x = 1
. .coord.y = 2

works fine. 


> On 3/15/06, Ulrich Kohler <[email protected]> wrote:
> > We try to reproduce the introductive class programming example shown
> > in [P] "class - class programming", pg. 28. Unfortunately we get the
> > error message "set 1 2: class member function not found, r(4023);".
> > Any ideas what happens here.
> >
> >
> > ---------------------------------
> > . do 11.class
> > . version 9
> > . class coordinate {
> > .       double x
> > .       double y
> > . }
> > . program .set
> >  1.         args x y
> >  2.         .x = `x'
> >  3.         .y = `y'
> >  4. end
> > .
> > end of do-file
> >
> > . .coord = .coordinate.new
> >
> > . .coord.set 1 2
> > set 1 2: class member function not found r(4023);
> > --------------------------------------
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

-- 
[email protected]
+49 (030) 25491-361
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index