Results 1 to 4 of 4

Thread: What will happen if re-implementing non-virtual functions?

  1. #1
    Join Date
    Oct 2008
    Location
    Beijing China
    Posts
    77
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question What will happen if re-implementing non-virtual functions?

    for example if i re-implement
    Qt Code:
    1. QPushButton: : setText(const QString &)
    To copy to clipboard, switch view to plain text mode 
    in subclass of QPushButton like this, what will happen?
    Qt Code:
    1. void MyPushButton::setText(const QString &text)
    2. {
    3. QPushButton::setText(text);
    4. //do sth. i would like
    5. {
    6. .....
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What will happen if re-implementing non-virtual functions?

    go ahead and do whatever u want..QT is C++ after all....

  3. The following user says thank you to talk2amulya for this useful post:

    nifei (17th February 2009)

  4. #3
    Join Date
    Oct 2008
    Location
    Beijing China
    Posts
    77
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Red face Re: What will happen if re-implementing non-virtual functions?

    I'm also new in c++. Thank you!

  5. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What will happen if re-implementing non-virtual functions?

    Read about function overloading and overriding in classes in c++ , you will get your answer

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  2. Qt/Embedded Installation error during make
    By mahe2310 in forum Installation and Deployment
    Replies: 5
    Last Post: 7th September 2006, 04:05
  3. linking libraries
    By JustaStudent in forum Newbie
    Replies: 29
    Last Post: 2nd May 2006, 08:30
  4. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26
  5. warning message on compile not understood
    By impeteperry in forum Qt Programming
    Replies: 13
    Last Post: 23rd January 2006, 23:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.