Class Definition Syntax:
class classname
{
//fields
//properties
//methods
}
Fields Declaration Syntax:
accessmodifier functionalModifier datatype variablename;(or)
accessmodifier functionalModifier datatype variablename = value;
Note 1: We cover about ―Properties‖ syntax in further hours.
Note 2: The functional modifiers are static, readonly, virtual, override. We cover about these modifiers also in further hours.
Methods (Member Functions) Declaration Syntax:
accessmodifier functionalModifier returntype/void methodname(args)
{
//method body
}
Object (Instance) Construction Syntax:
//object reference creationclassname objname;//memory allocationobjname = new classname(); ( or )//object creation along with memory allocationclassname objname = new classname()Accessing Object Members:
obj.field
obj.property
obj.method()

No comments:
Post a Comment