UrbanPro

Learn C++ Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

In c++ have a default constructor?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Trainer

yes, with no parameters
Comments

IT Professional Trainer with 15 years of experience in IT Industry

If you do not define a constructor, the compiler will define a default constructor for you. The implementation of this default constructor is: default construct the base class (if the base class does not have a default constructor, this is a compilation failure) default construct each member...
read more
If you do not define a constructor, the compiler will define a default constructor for you. The implementation of this default constructor is: default construct the base class (if the base class does not have a default constructor, this is a compilation failure) default construct each member variable in the order of declaration. (If a member does not have a default constructor, this is a compilation failure). Note: The POD data (int,float,pointer, etc.) do not have an explicit constructor but the default action is to do nothing (in the vane of C++ philosophy; we do not want to pay for something unless we explicitly ask for it). If no destructor/copy Constructor/Assignment operator is defined the compiler builds one of those for you (so a class always has a destructor/Copy Constructor/Assignment Operator (unless you cheat and explicitly declare one but don't define it)). The default implementation is: Destructor: If user-defined destructor is defined, execute the code provided. Call the destructor of each member in reverse order of declaration Call the destructor of the base class. Copy Constructor: Call the Base class Copy Constructor. Call the copy constructor for each member variable in the order of declaration. Assignment Operator: Call the base class assignment operator Call the assignment operator of each member variable in the order of declaration. Return a reference to this. Note Copy Construction/Assignment operator of POD Data is just copying the data (Hence the shallow copy problem associated with RAW pointers). read less
Comments

Related Questions

What is polymorphism in C++?
https://vz-3ad30922-ba4.b-cdn.net/22b3f0e4-e072-48b7-9ae6-3d65a6b4ad50/play_480p.mp4
Renu
0 0
5
What is the actual size of INT in the C language, 2 or 4 bytes?
The actual size to int is determined by the compiler as the program runs. But theoretically the size is 2 bytes. You can increase the size by adding keyword long infront of it to make the size 4 bytes. Eg int a; // 2 bytes Long int b; // 4 bytes
Kunal
Describe about private access specifier?
Private keyword, means that no one can access the class members declared private outside that class. By default class variables and member functions are private.
Prasad
1 1
8
Are C Programmers currently in demand?
Ofcourse, C is alwasy in demand. In the beginning a lot of the big project developed in C language. Now a days, there are a lot of language in market and speciallity is growing in IT field. For a big organization...
Harsha
Is C++ is next version of C?
This feature looks pretty sweet. This would be great because you wouldn't need getters any more. You could make member variables public; later, if you change your mind, you can turn them into property.
Subham

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Object Oriented Programing
Object Oriented Programming Concepts: Object Oriented Programming follows bottom up approach in program design and emphasizes on safety and security of data. Features Of Object Oriented Programming: Inheritance: ...

Is It Fine To Write “void main()” Or “main()” In C/C++?
The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming...

Templates
Templates Advantages of templates: Code reuse Allows container classes (e.g. lists, arrays, etc.) to be simply defined without loss of static type checking or run-time efficiency. Allows definition...

Contents Of C++ Programming
1. History of CPP 2. Concepts of OOP's 3. Introduction and Features of CPP (OOP's) 4. Characteristics of OOP's 5. CPP Keywords 6. Major Components of CPP: Encapsulation Inheritance Polymorphism 7....

Recommended Articles

Introduction C++ is an excellent programming language and many of the applications are written in C++ language. It has generic, object-oriented & imperative programming features, and also provides facilities for low-level memory manipulation. Successor of C language, it is an OOP (object oriented programming) language...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Looking for C++ Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more