View Full Version : Qustion in c/c++
durga madhaba pradhan
06-15-2006, 04:41 PM
Q.1 Main is user defind or system defind?
Q.2 Why member selection (.),pointer-to-member selection(.*),scope resolution operator(::)and conditional(?:) are not overloaded?
Q.3 Why constructor are not virtual?
Q.4 what is object optimization?
plz repply me as soon as.
i3839
06-15-2006, 05:37 PM
A.1 Main is defined per process.
A.2 Because everyone would get insane then (for all I know it is possible with C++, but maybe even they thought that would go too far). I think the reason is because those tokens are used to address something or add conditionals, while in general you can only overload operations. Doing object.member only tells on what member you're working, it doesn't do anything in itself. Besides, you overload operation on some object, while these things aren't object specific. But no worry, you can always define things like ".member" to something else with macros. ;-)
A.3 Because it's supposed to do class specific initializations stuff. If you want to override that in a derived class then you need to force it yourself (see link below).
A.4 Opitmization is a very generic term, so is object, which makes answering this question quite hard.
Useful C++ url:
http://www.parashift.com/c++-faq-lite/
But if you google for items you're interested about like "c++ virtual constructor" you get plenty of hits. I'm no C++ guru, so pardon my brief answers.
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.