Welcome to Web-News
A Web-based News Reader
Subject Re: What does 'final' keyword exactly?
From Derek Parnell <derek@psych.ward>
Date Mon, 6 Jun 2005 12:03:22 +1000
Newsgroups digitalmars.D

On Sun, 5 Jun 2005 18:14:33 -0700, Andrew Fedoniouk wrote:

> E.g. here: (std.openrj)
>
> class Field
> {
> ....
>     final char[]  name()
>     {
>         return m_name;
>     }
>     final char[]  value()
>     {
>         return m_value;
>     }
> ...
> }
>
> Andrew.

My understanding is that you can't derive  a new class from this class
*and* override any of the 'final' members. That is, you can't do this sort
of thing ...

class Field
{
    char[] m_name;
    char[] m_value;

    final char[]  name()
    {
        return m_name;
    }
    final char[]  value()
    {
        return m_value;
    }

}

class SField : Field
{
    char[] mx_name;
    char[] mx_value;
    char[] name()  // Fails.
    {
        return mx_name;
    }

}


--
Derek
Melbourne, Australia
6/06/2005 12:02:05 PM

Recent messages in this thread
 
-# What does 'final' keyword exactly? Andrew Fedoniouk 05-Jun-2005 09:14 pm
.-# Re: What does 'final' keyword exactly? Jarrett Billingsley 05-Jun-2005 10:04 pm
.||# Re: What does 'final' keyword exactly? Jarrett Billingsley 05-Jun-2005 10:12 pm
.||# Re: What does 'final' keyword exactly? Andrew Fedoniouk 05-Jun-2005 10:49 pm
.|-# Re: What does 'final' keyword exactly? Andrew Fedoniouk 05-Jun-2005 11:04 pm
.|.\# Re: What does 'final' keyword exactly? Jarrett Billingsley 06-Jun-2005 11:33 am
.-# Re: What does 'final' keyword exactly? (Current message) Derek Parnell 05-Jun-2005 10:03 pm
..-# Re: What does 'final' keyword exactly? Andrew Fedoniouk 05-Jun-2005 10:39 pm
...-# Re: What does 'final' keyword exactly? Derek Parnell 05-Jun-2005 11:23 pm
....\# Re: What does 'final' keyword exactly? Andrew Fedoniouk 05-Jun-2005 11:48 pm