Berkeley CSUA MOTD:Entry 25587
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2002/8/16-18 [Computer/SW/Languages/Java] UID:25587 Activity:low
8/17    In C++ (and Java), virtual functions are "turned off" in the
        constructors and destructors, right?  Since the child class
        isn't available.
        \_ you can definitely have virtual destructors (in C++).
           It is strongly recommended.
           \_ I meant calling a VF from a ctor or dtor.  --OP
              \_ even if it were legal, that is really bad style.  A parent
                 class having knowledge of children classes? Bad bad bad.
                 \_ Um, the point of a VF is that you don't have to know the
                    exact behavior.  Fortunately, this isn't allowed anyway.
        \_ They're not "turned off"--that is, the compiler doesn't prevent you
           from calling them, but you shouldn't expect them to work.  When
           you're constructing, you start at the base constructor and work your
           way down the inheritance chain.  So if you try to call a virtual
           function in that process, the full type hasn't been constructed and
           you can't expect anything predictable.  Similarly in the destructor.
           This is a reason many people on the C++ community are asking for
           "post-construction" and "pre-destruction" functions.
           \_ This is incorrect.  It is perfectly predictable; in a constructor
              you are guaranteed to have the virtual functions defined in that
              class or any base class.  --pld

lazy emacs user was here
2025/05/25 [General] UID:1000 Activity:popular
5/25    

You may also be interested in these entries...
2013/5/1-18 [Computer/SW/Languages/Java, Computer/Theory] UID:54669 Activity:nil
5/1     What's the difference between CS and Computer Engineering?
        http://holykaw.alltop.com/top-ten-paying-degrees-for-college-graduates
        \_ One is science and the other is engineering.
        \_ From http://en.wikiquote.org/wiki/Computer_science
           'A folkloric quotation ... states that "computer science is no more
           about computers than astronomy is about telescopes."  The design
	...
2012/12/4-18 [Computer/SW/Languages/Java] UID:54544 Activity:nil
12/4    Holy cow, everyone around me in Silicon Valley is way beyond
        middle class according to Chinni's definition:
        http://en.wikipedia.org/wiki/American_middle_class
        \_ Let's set our goals higher:
           http://en.wikipedia.org/wiki/Upper_middle_class_in_the_United_States
           \_ How about this one?
	...
2012/10/29-12/4 [Science/Disaster, Computer/SW/Languages/Java, Politics/Domestic/President/Bush] UID:54516 Activity:nil
10/29   Go Away Sandy.
        \_ Sorry, Coursera is performing preventive maintenance for this
           class site ahead of Hurricane Sandy. Please check back in 15 minutes.
           class site ahead of Hurricane Sandy. Please check back in 15
           minutes.
        \_ Bitch.
	...
2012/1/18-3/3 [Computer/SW/Languages/Java, Finance/Investment] UID:54290 Activity:nil
1/18    I own a bunch of NFLX stocks bought at several different periods
        (from high $200 all the way down to $80). I dumped a few and
        still have a few. Why the hell is Reid Hastings still making
        $500,000/year? How do I join the pending NFLX Class Action
        Lawsuit?
        \_ Why would you buy stock in a company run by a narcissistic
	...