Object,Class and Inheritance

 Object- 

Object is basically used to bridge a communication between class body and main body. Object are always created inside the main body.

Syntax- 

className  objName =  new className(); 
objName.function();//it could be any function inside the class.

new- new keyword is known as Memory allocation operator. 
dot(.)- Member access operator used to access functions.

    class Program
    {
        public void display(int a1)
        {
            Console.WriteLine("I am a function ");
        }
        static void Main(string[] args)
        {
            int a;
            Program p1 = new Program();
            p1.display();
            Console.ReadKey();
        }
    }
}

Class-  

Class is defined as the collection of data members and member functions. 
 
Data members- all the variable inside the class . 
Member functions- all the functions .  
 
Inheritance :- 

Inheritance is the reusability of class. 
 
Types of classes- 

1. Base Class(top class of the program) 

2. Derived Class  

Rules of Inheritance-  

1. Derived class accesses information to base class. 
2. Base class can not accesses information to derived class.
3. Always last class's object is created.(!imp) 

Comments

Popular posts from this blog

Parameter Query

Final Project

Grid View Paging