Skip to main content

Posts

Showing posts from 2014

Session 4:- Constructor in c#

Date Wednesday, December 04, 2013 Time Description 10.00 am to 12.00 pm Constructor, Destructor, Inheritance, Constructor in inheritance Learning : It is same as that of function but difference is that it does not have any return type.             Its name is same as that of the class, it cannot be inherited. Constructor of a class is expected when object of the class is created usually we put initialisation code in the constructor. Eg. Public class myclass {    Public myclass()   {      //constructor body or initialisation code   } } C # supports constructor overloading, i.e we can have constructor with different set of parameter for same class Eg.  1: Public class myclass 2: { 3: Public myclass() 4: { 5: //default constructor 6: } 7: Public myclass(int a, int b) 8: ...

Structure,Property,Indexer in c#

Date Monday, December 02, 2013 Time Description 10.00 am to 12.00 pm Structure,property,indexer Learning : Structure:- Structures are used to represent a record. User defined value types are known as structures.Structures are stored on stack and contains values directly. eg:- struct cycle {   Int val, min_speed,max_speed; }; Static void main(string[] args) {   Cycle c;    c.val=10;    c.min_speed=30;    c.max_speed=50; console..writeline(“max speed is {0}”,c.max_speed); }   Features of c# structures:-      1)Structures can have methods, fields, indexers, properties, events.      2)Structures can have defined constructors and not destructors.however you cannot define a default constructor to the structure.      3)Structure members canno...