You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by john oh <oh...@gmail.com> on 2005/12/12 23:37:12 UTC

problem accessing extended methods from template

Hello,

I have a class (B) that extends another (A) like so
===============================================
class A{
protected String str = "A";
public String doA()
return this.str;
}

class B extends A{
}
===============================================

In my template, I use the inherited method doA(), but this does not
work. It doesn't print "A"
===============================================
template.tpl
$b.doA()
===============================================


I'm probably doing something wrong here. Can anyone see a problem with this?



Thank you,
John

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: problem accessing extended methods from template

Posted by john oh <oh...@gmail.com>.
Thanks Barbara! You're suggestion helped.

On 12/12/05, Barbara Baughman <ba...@utdallas.edu> wrote:
> Class B needs to be public
>
> public class B extends A {
>
> Class A needs to be public
>
> public Class A {
>
> Barbara Baughman
> X2157
>
> On Mon, 12 Dec 2005, john oh wrote:
>
> > Hello,
> >
> > I have a class (B) that extends another (A) like so
> > ===============================================
> > class A{
> > protected String str = "A";
> > public String doA()
> > return this.str;
> > }
> >
> > class B extends A{
> > }
> > ===============================================
> >
> > In my template, I use the inherited method doA(), but this does not
> > work. It doesn't print "A"
> > ===============================================
> > template.tpl
> > $b.doA()
> > ===============================================
> >
> >
> > I'm probably doing something wrong here. Can anyone see a problem with this?
> >
> >
> >
> > Thank you,
> > John
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: problem accessing extended methods from template

Posted by Barbara Baughman <ba...@utdallas.edu>.
Class B needs to be public

public class B extends A {

Class A needs to be public

public Class A {

Barbara Baughman
X2157

On Mon, 12 Dec 2005, john oh wrote:

> Hello,
>
> I have a class (B) that extends another (A) like so
> ===============================================
> class A{
> protected String str = "A";
> public String doA()
> return this.str;
> }
>
> class B extends A{
> }
> ===============================================
>
> In my template, I use the inherited method doA(), but this does not
> work. It doesn't print "A"
> ===============================================
> template.tpl
> $b.doA()
> ===============================================
>
>
> I'm probably doing something wrong here. Can anyone see a problem with this?
>
>
>
> Thank you,
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org