Thread: Class Procedures

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    42

    Class Procedures

    What are the benefits from using virtual
    and where do inline functions fit in
    and when should inline be invoked


    Can anyone give us some background information
    on how these class procedures interact


    Marky_Mark

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    What are the benefits from using virtual
    If by this you mean virtual functions, then they allow the correct class methods to be called at runtime, given the base pointer. This also means that classes that are inherited and use virtual methods can be stored in generic containers (you don't need a seperate list/array for each class type).

    where do inline functions fit in
    and when should inline be invoked
    Any class method that has it's implementaion included in the declaration is considered inline, or the implementation can be external and still be inline by explicitly specifying them as inline as you would global functions. They should only be used for small functions that are used often, in which case they'll speed your program up. If you use them on large functions they'll cause code bloat which will increase the chances of cache misses which will slow your program down.
    zen

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    42
    Im still lost...


    Is it cause virtuals are global and visible to all
    derived base classes or are virtuals visible to all
    classes derived or not


    Does inline act as an additional constructor to it's
    base class


    I think i need to buy a book or two?


    Marky_Mark
    Last edited by Marky_Mark; 10-27-2001 at 09:19 AM.

  4. #4
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Is it cause virtuals are global and visible to all
    derived base classes or are virtuals visible to all
    classes derived or not
    No, it depends on the implementation but it's something like each class has a hidden table of function pointers (a v-table) and a pointer that points to the correct function for each instance.


    Does inline act as an additional constructor to it's
    base class
    No inlining is independent from inheritance and polymorphism.

    I think i need to buy a book or two?
    Yes.
    zen

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    42
    Thanks zen



    Marky_Mark

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 04:30 AM
  2. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. class errors
    By romeoz in forum C++ Programming
    Replies: 3
    Last Post: 09-16-2003, 07:57 PM