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 Interview Q&A Tutorials Oracle Sql server .NET Java Soft skills CV GD Work from home Online practice test FAQs in PDF Books Jobs FAQs
Interview questions                                 
.NET FAQs
C#.NET FAQs
VB.NET FAQs
Check your Framework skills!
Check your ASP.NET skills!
Test your ADO.NET skills!
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
.NET Framework
 
ADO.NET
OOPS in .NET
Net mobile
LINQ
.NET compact framework
Silverlight
 
 

.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..............

 
Want to be hunted by potential employers? Just submit your key skills!

Popular FAQs

.NET .Net Architecture ADO.NET Java Oracle C#.NET
VB.NET DOT.NET AJAX ASP.NET NET Framework OOPS in .NET
C++ Sql Server Data warehousing EJB MySQL Linux
PHP UML Networking Testing XML  
 
Copyright © 2008 - 2010 CareerRide.com. All rights reserved.