Scope of a Declaration

Posted extjs4

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Scope of a Declaration相关的知识,希望对你有一定的参考价值。

 

6.3. Scope of a Declaration

 

The scope of a declaration of a member m declared in or inherited by an interface type I (§9.1.4) is the entire body of I, including any nested type declarations.

interface I{
	class C{}
	static class D{}
}

The scope of a class‘s type parameter (§8.1.2) is the type parameter section of the class declaration, the type parameter section of any superclass or superinterface of the class declaration, and the class body.

The scope of an interface‘s type parameter (§9.1.2) is the type parameter section of the interface declaration, the type parameter section of any superinterface of the interface declaration, and the interface body.

interface IU<T>{ }
class CU<T>{}

public class main3<X extends Number> extends CU<X> implements IU<X> {

}

  

The scope of a constructor‘s type parameter (§8.8.4) is the entire declaration of the constructor, including the type parameter section, but excluding the constructor modifiers. 

public class main3{
	
	public <A,B extends A> main3(){
		
	}

}

  

 The scope of a local variable declaration in a block (§14.4) is the rest of the block in which the declaration appears, starting with its own initializer and including any further declarators to the right in the local variable declaration statement. 

int a = 1,b = a;

  

The scope of a local variable declared in the ForInit part of a basic for statement (§14.14.1) includes all of the following:

  • Its own initializer

  • Any further declarators to the right in the ForInit part of the for statement

  • The Expression and ForUpdate parts of the for statement

  • The contained Statement

ForInit、ForInitializer与ForUpdate

 

 

 

 

 

 

 

 

 

以上是关于Scope of a Declaration的主要内容,如果未能解决你的问题,请参考以下文章

linux系统下,警告:warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration] 和 war

错误“a label can only be part of a statement and a declaration is not a statement”解决方法

错误“a label can only be part of a statement and a declaration is not a statement”解决方法

error: declaration of 'cv::Mat R ' shadows a parameter

error: a label can only be part of a statement and a declaration is not a statement

declaration of 'void* operator new [](size_t)' has a different exception specifier