9 Classes and Interfaces
9.1 Classes
9.1.1 Syntax
class
→
class‑specifiers
class
class‑name
template‑parameter‑list
?
inheritance‑and‑interfaces
?
{
class‑content
}
class‑specifiers
→
(
access
|
abstract
|
static
)*
class‑name
→
identifier
inheritance‑and‑interfaces
→
:
base‑class‑or‑interface
(
,
base‑class‑or‑interface
)*
base‑class‑or‑interface
→
qualified‑id
class‑content
→
class‑member
*
class‑member
→
static‑constructor
|
constructor
|
member‑function
|
member‑variable
|
property
|
indexer
|
class
|
enumerated‑type
|
constant
|
delegate
|
class‑delegate
static‑constructor
→
attributes
?
static
extern
?
class‑name
(
)
(
compound‑statement
|
;
)
constructor
→
attributes
?
constructor‑specifiers
class‑name
parameter‑list
(
:
initializer
)? (
compound‑statement
|
;
)
constructor‑specifiers
→
(
access
|
extern
)*
initializer
→
this
(
argument‑list
)
|
base
(
argument‑list
)
member‑function
→
attributes
?
member‑function‑specifiers
return‑type
function‑group‑id
parameter‑list
(
function‑body
|
;
)
member‑function‑specifiers
→
(
access
|
abstract
|
extern
|
new
|
override
|
static
|
virtual
)*
member‑variable
→
member‑variable‑specifiers
type‑expr
member‑variable‑name
;
member‑variable‑name
→
identifier
member‑variable‑specifiers
→
(
access
|
static
)*
property
→
property‑specifiers
type‑expr
property‑name
{
getter‑or‑setter
+
}
property‑specifiers
→
(
access
|
static
)*
property‑name
→
identifier
getter‑or‑setter
→
get
compound‑statement
|
set
compound‑statement
indexer
→
indexer‑specifiers
type‑expr
this
[
type‑expr
indexer‑name
]
{
getter‑or‑setter
+
}
indexer‑specifiers
→
(
access
|
static
)*
index‑name
→
identifier
9.2 Interfaces
9.2.1 Syntax
interface
→
interface‑specifiers
interface
interface‑name
{
interface‑content
}
interface‑specifiers
→
access
?
interface‑name
→
identifier
interface‑content
→
interface‑memfun
*
interface‑memfun
→
return‑type
identifier
parameter‑list
;