Find jobs | Company-wise jobs
Jobseekers | Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career services Resume services Interview Q&A Articles Oracle SQL Server NET Java Soft Skills CV GD Work from home Books store
Interview questions
.NET FAQs
C#.NET FAQs
VB.NET FAQs
DOT.NET FAQs
NET framework
NET assembly
NET code security
NET access modifiers
NET architecture
NET base class library
NET CLR
NET constants,enum,arrays
NET data types
NET menu
NET garbage collection
NET debug and trace
NET properties
NET form
NET assemblies & resources
NET class & structures
NET binding,viewing,filtering
NET configuring & optimizing
NET configuring setup project
NET constructors & destructors
NET control
NET dataset objects
NET debugging tools
NET debug & trace classes
NET delegates & events
NET exception handling
NET globalization-localization
NET interoperability
NET project deployment
NET securing application
NET using XML
NET validating user input
NET windows communication
NET windows presentation
NET windows workflow
NET Crystal Reports
ADO.NET
.NET Framework
OOPS in .NET
 
ASP.NET | ADO.NET | AJAX
C#.NET | VB.NET | PHP
NET Remoting | NET Interview
  
C | C++ | Java | Oops
Data Structure | OS
   
Database concepts | Oracle
SQL Server | Biztalk | Sharepoint
Notification services
Reporting Services
Service-oriented architecture
Data warehousing | MySQL
  
Project Management 
Linux | Testing | Networking
Software engineering 
Microsoft solution framework 
  
UML | XML | HTML | SOAP 
CSS | VBScript  | Web Services
   
CV Cover letter | Interview 
HR | Soft skills | GD 
Working from Home 
Tutorial
ASP.NET | VB.NET | C#.NET     
Remoting.NET | Web service
Remoting overview | ADO.NET
UML | Sql server 
More links
Model View Controller 
Understanding Anonymous Types 
Working with the DataList Control 
Windows Presentation Foundation (WPF) 
Books on ASP.NET
ASP.NET 3.5 Application Architecture and Design 
LINQ Unleashed for C# 
ASP.NET Data Presentation Controls Essentials 
Microsoft Expression Blend Unleashed 

.NET constructors & destructors


.NET constructors and destructors - Interview questions

<<Previous  Next>>

.NET constructors and destructors - October 30, 2008 at 18:10 pm by Amit Satpute

Explain constructor and destructor with an example using C#.NET.

A constructor is a member function that performs the task of initializing the objects with the default values to be assigned after creation.

A destructor is a function that is run to release the resources held by an object when it is no longer needed by the application.

In C#.NET we can create constructor and destructor in the following manner:

-----------------CONSTRUCTOR---------

class C
{
       private int x;     
       private int y;
       public C (int i, int j)
       {
                 x = i;
                 y = j;
       }
       public void display ()      
       {
               Console.WriteLine(x + "i+" + y);
       }
}

-----------------DESTRUCTOR---------

class D
{
        public D()
        {
            // constructor
        }          
        ~D()
        {
           // Destructor
        }
}


<<Previous  Next>>

Also read

Object Serialization in .NET

Explain about Serialization in .NET. Explain binary serialization and XML serialization.
What is Formatters? Explain the binary formatter and the SOAP formatter.
Explain why Serialization.
Explain the components that comprise the binary serialization architecture......

What is a CLR (Common Language Runtime)?

Common Language Runtime is a run time environment for .NET..........

Explain the concepts of CTS and CLS(Common Language Specification).

CTS define how these different variables are declared and used in run time...........

Explain Boxing and Unboxing in .NET.

Boxing permits any value type to be implicitly converted to type object or to any interface type Implemented by value type.............

What is Operator Overloading in .NET?

Operator overloading is the most evident example of Polymorphism. In operator overloading, an operator is ‘overloaded’.............

What is Finalize method in .NET?

Object.Finalize method in .NET is typically used to clean and release unmanaged resources like OS files, window etc..............

 
More content
Java FAQ | Personal Interview
Earn promotion|Happy employee
Write a good CV | Cover Letter
Become boss's favorite | CV tips
Training and Development
Public relations
PM | CareerRide is hiring
Frequently Asked Questions
CV Writing
Testing
XML
.NET
AJAX
ASP.NET
VB.NET
C#.NET
NET Framework
OOPS in .NET
C++
Data warehousing
Sql Server
Core Java
JDBC
JMS
JSP
RMI
J2ME
EJB
MySQL
Linux
PHP
UML
ADO.NET
Net Architecture
Personal interview
Marketing
Mass communication
Java FAQs
Oracle FAQs
C#.NET FAQs
VB.NET FAQs
DOT.NET
Networking FAQs
MySQL FAQs
Copyright © 2008 - 2010 CareerRide.com. All rights reserved.