Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

how to create a subclass

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75326] how to create a subclass
  • From: "T.Sariyski" <tsariysk at verizon.net>
  • Date: Wed, 25 Apr 2007 05:37:13 -0400 (EDT)

Hi,
I have a simple class myClass with one variable v1 and with access 
methods only:

Class[myClass,Object,{v1},{
    {new,Function[{lv1},new[super];
        setv1[self,lv1]]
    },   
    {setv1,Function[{lv1},v1=lv1]},
    {v1,v1&}
}]

I want to create a subclass mySub of myClass which in addition to v1 have one more variable v2. I tried variants of:

Class[mySub,myClass,{v2},{
    {new,Function[{lv2},new[super];
        setv2[self,lv2]]
      },
    {setv2,Function[{lv2},v2=lv2]},
    {v2,v2&}
}]

myObj=new[mySub,{v1,v2}]

but all my attempts failed. Somebody help, please?

Thanks, Ted




  • Prev by Date: Re: locating max value on the image
  • Next by Date: ordering a large matrix and referring to the named rows later
  • Previous by thread: Re: an expression with logs
  • Next by thread: ordering a large matrix and referring to the named rows later