Virtual Functions

This is a discussion on Virtual Functions within the C++ Programming forums, part of the General Programming Boards category; I'm getting the feeling that a virtual function only allows you read data members and you're not able to alter ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    92

    Virtual Functions

    I'm getting the feeling that a virtual function only allows you read data members and you're not able to alter or set them equal to anything in a virtual function. Is this true?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    No, that's not true. The thing that governs whether you can modify member variables is whether the function is const.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    92
    Oh, I did make it constant. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i need a good example of virtual functions
    By Anddos in forum C++ Programming
    Replies: 10
    Last Post: 02-15-2006, 11:48 AM
  2. Virtual Functions
    By guda in forum C++ Programming
    Replies: 3
    Last Post: 11-16-2004, 04:13 PM
  3. Thread creation on virtual functions
    By gustavosserra in forum C++ Programming
    Replies: 13
    Last Post: 10-14-2004, 09:03 AM
  4. recursive virtual functions
    By ygfperson in forum C++ Programming
    Replies: 0
    Last Post: 05-25-2003, 09:00 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 02:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21