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

What are the syntactic rules to be avoid ambiguity in multiple inheritance?

1135


What do you mean by early binding?

1026


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

1016


What is the use of c++ programming language in real life?

993


Why can’t you call invariants() as the first line of your constructor?

977


What are the implicit member functions of class?

1042


Which programming language is best?

942


Why was c++ made?

1051


What is microsoft c++ redistributable 2013?

1050


Write a program to concatenate two strings.

1038


Is c++ a difficult language?

1056


Is it possible to write a c++ template to check for a function's existence?

969


What is the syntax for a for loop?

1085


What is the use of class in c++?

1018


Which software is best for programming?

1102