Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why can you not make a constructor as const?

Answer Posted / som shekhar

If the function is declared constant then you are not
intended to change the member variables of the class and if
you did the compiler throws an error.
In this case you can change the variable inside the const
function if the variable is declared as VOLATILE.

Similarly if you declare a variable as const then you cannot
change the value of the variable through its life time.

Now if you declared the constructor then you cannot
initialize the object.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

1097


How does atoi function work?

1178


What is rvalue?

1196


Why is c++ still used?

1138


When do we use copy constructors?

1133


What is oops in c++?

1116


What is lvalue?

1219


Declare a class vehicle and make it an abstract data type.

1028


What is c++ flowchart?

1462


Which format specifier is used for printing a pointer value?

1109


Write about the members that a derived class can add?

1028


Is the declaration of a class its interface or its implementation?

1232


What are 2 ways of exporting a function from a dll?

1279


Where is atoi defined?

1210


what is data abstraction in C++?

1125