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 events occur in intr activated on interrupt vector table

1667


What is the size of a vector?

1060


Explain the difference between using macro and inline functions?

1053


What is c++ vb?

1028


What is a class template?

1025


What is a multiset c++?

1076


What are the differences between new and malloc?

1046


Can we inherit constructor in c++?

1021


What is the use of 'this' pointer?

1206


What does extern mean in a function declaration in c++?

1154


Describe protected access specifiers?

1143


What are the differences between malloc() and calloc()?

1107


Can the creation of operator** is allowed to perform the to-the-power-of operations?

948


What is java and c++?

1098


Why c++ is called oop?

1054