www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - final conflicts with override?

interface v
{
	void func();
}
interface d:v
{
	void d();
}
interface m:v
{
	void m();	
}
interface r:d,m
{
	void r();	
}
class c:r
{
	final override void func(){};
	void d(){}
	void m(){}
	void r(){}
}

This snippet doesn't compile.

final can't overlap the semantic of override.

class c
{
   void cfunc(){}
}

class b:c
{
   final void cfun(){};
// what if above just a typo of cfunc?
   final override void cfunc(){}
// this doesn't have such problem, it asks the compiler if there's a cfunc  
exist in the base class or interface
}


-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Jun 16 2009