GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 45 of 47    Print  
Default Constructor
What is the Default Constructor?


  
Total Answers and Comments: 2 Last Update: August 20, 2009     Asked by: haruninhyo 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: VENKATGOPU
 
The deafual constructor is a constructor. It may be contains arguemnets (default arquemnets) or It may not be contains arquemnet

Example

class A
{
     public:
               A(){/*body*/}                           //Deafult constructor without arquemnet      
   
                                                           or
            
              A(int a=0,int b=0){/*body*/}   //Default constructor with default arquement
};

if you did not write any constructor within class A. The implicit constructor or inline constructor A::A() /*[without no body] */ will be called when you create object for class A

Note: you can't use both constructor in same class. Confilict occur when you create object of class A that whether to call first one or second one (ambiguity)

Thanks & Regards
Venkat Gopu

Above answer was rated as good by the following members:
shreya_sen
June 10, 2009 06:23:19   #1  
VENKATGOPU Member Since: May 2009   Contribution: 9    

RE: Default Constructor
The deafual constructor is a constructor. It may be contains arguemnets (default arquemnets) or It may not be contains arquemnet

Example

class A
{
public:
A(){/*body*/} //Deafult constructor without arquemnet

or

A(int a 0 int b 0){/*body*/} //Default constructor with default arquement
};

if you did not write any constructor within class A. The implicit constructor or inline constructor A::A() /*[without no body] */ will be called when you create object for class A

Note: you can't use both constructor in same class. Confilict occur when you create object of class A that whether to call first one or second one (ambiguity)

Thanks & Regards
Venkat Gopu

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 20, 2009 08:38:32   #2  
shreya_sen Member Since: August 2009   Contribution: 1    

RE: Default Constructor
A default constructor is a type of constructor which does not have any arguments/parameters.
Thus it is executed as the object is created.

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Disadvantage:- You cann't create object of that particular class.Advantage:- you can bound the user to use the static function of that class to create the object so that your function can keep track of all the objects created ,according to the ...

What is the Default Constructor? 
Latest Answer : A default constructor is a type of constructor which does not have any arguments/parameters.Thus it is executed as the object is created. ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.   When a programmer wants other than integer values to be returned from function then it is essential that the pro
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

The Difficult Past of Neuro-linguistic programming

The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
 

History of Neuro Linguistic Programming (NLP)

History of Neuro linguistic programming Neuro Linguistic Programming NLP is a system co founded by John Grinder and Richard Bandler for bringing about personal development in any individual by interpreting and translating the human perception experience beliefs and language It was developed in early
 

The Use of Access Specifiers In Object Oriented Programming

The Use of Access Specifiers In Object Oriented Programming In object oriented programming a variable will have a certain range This range can be defined as the place where it can be viewed In most cases there are two simple models that are used and these are lexically scoped and dynamically scoped
 

Class-based Object Oriented Programming

Class based Object Oriented Programming Class based object oriented programming is a style that gains inheritance by processing classes as objects The most prominent style of OOP is class based instead of object based With the class based OOP system objects are units that merge states identities and
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape