Showing posts with label fresher. Show all posts
Showing posts with label fresher. Show all posts

Sunday, 8 January 2012

Article 3:-Advance Detail of constructor


For Asp.net Training with C# Click Here

Written By:-Isha Malhotra
Email:-malhotra.isha3388@gmail.com


In the previous article we have learnt the class and constructor in the basic level and in second article we learnt constructor in more detail. Now In this article we will learn advance detail about the constructors
Calling Constructor from another Constructor
Or
Constructor chaining
If you ask the question that can we call constructor from another constructor then I will say yes we can. Calling constructor from another constructor is known as constructor chaining. This can be done by the keyword this and base. Here we discuss on this keyword and will discuss base keyword in the article constructor with inheritance.

Saturday, 7 January 2012

Article 2:-Constructor in more Detail


For Asp.net Training with C# Click Here

Written By:-Isha Malhotra
Email:-malhotra.isha3388@gmail.com


In the previous article Click here for previous article we have learnt the class and constructor in the basic level. In this article we will learn more about the constructors and will study constructor in detail.

Ques:-1 what is the difference between method and constructors?
Ans:- a) Constructor doesn’t have any return type not even void but every method must contain the return type and if any method doesn’t return anything then it will return void.
b) Constructor called automatically but method is called by the object or with the class name
Note:-in case of static method we call method with the name of class.
c) Constructer will be called only once but we can call the method many times.

Ques 2:-What is the type of constructors?
Ans:- there are two types of constructor and these are following
a)      Static Constructor(also known as class constructor)
b)      Non static Constructor(also known as instance constructor)

Friday, 6 January 2012

Article1:-Concept of Classes and Constructor with Example


For Asp.net Training with C# Click Here

Written By:-Isha Malhotra
Email:-malhotra.isha3388@gmail.com

Ques:-1 What is the Class?
Ans:- Class is the way to realize real time entity in oops. It is the user defined data type.
Syntax of Class
public class Class_Name
Note: public is an access modifier which can be anything like public,private etc.

Ques:-2 What is the Object?
Ans:-Object is the Runtime Entity of the Class.
Syntax of object Creation
Class_Name  object_Name=new Class_Name()

Ques:3 What is Constructor?
Ans:-Constructor is the method inside the class which is used to initialize or give default value to the class member variable. It is invoked when we create new instance of the class.
Features of Constructor
It has same name as the name of the class
It is called automatically when the instance of the class created.
It doesn’t have any return type not even void
Syntax of Constructor