Thread: c++ equivalent for C#'s "sealed override"?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Inline is a slippery slope that I avoid and this thread is proof why. There are millions of answers and possiblities as to what each compiler does and does not do for inline. B/c of this I avoid using it. It's almost harder to figure out when the compiler will or will not inline than it is to take the hit for the function call and make sure the function is optimized.

    AFAIK there is no equivalent to sealed in C++. I personally find it useless in C# b/c as abachler said if you do not want to override then don't. If you derive from the interface, however, you should be forced to implement all of it's pure virtual functions. I can't think of a reason in the world why you would need to prevent other programmers from implementing a base class pure virtual or virtual function. If a function is declared as pure virtual then you are essentially saying you must provide an implementation and if you declare it as virtual you are saying you can provide an alternate implementation. If you don't want anyone providing a different impl for the function then don't declare it in a manner that clearly is intended for that very purpose.
    Last edited by VirtualAce; 12-17-2009 at 06:01 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Equivalent of Dos 'copy' in C ?
    By YetBo in forum C Programming
    Replies: 17
    Last Post: 11-04-2009, 10:10 PM
  2. Pointer equivalent to array notation
    By bekkilyn in forum C Programming
    Replies: 4
    Last Post: 12-06-2006, 08:22 PM
  3. Replies: 10
    Last Post: 08-17-2005, 11:17 PM
  4. Header File Question(s)
    By AQWst in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2004, 11:31 PM
  5. Replies: 0
    Last Post: 11-01-2002, 11:56 AM