Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:50:53+00:00 2026-06-01T10:50:53+00:00

I am making an abstract-base-class and was thinking I might want a pure virtual

  • 0

I am making an abstract-base-class and was thinking I might want a pure virtual signal. But when I compiled I get a warning for the pure virtual signals I have defined:

../FILE1.h:27: Warning: Signals cannot be declared virtual
../FILE1.h:28: Warning: Signals cannot be declared virtual

Is it valid to define a pure virtual signal in C++/Qt? Is it valid to define a virtual signal?

Qt’s signal and slot documentation page says you can define virtual slots but doesn’t talk about signals. I can’t seem to find good information on pure virtual signals.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:50:54+00:00Added an answer on June 1, 2026 at 10:50 am
    • Signals don’t ever have an implementation[1] (i.e. you define the signal in your .h file and then there is no implementation in the .cpp).
    • The main purpose of declaring a function pure virtual is to force the inheriting class to provide an implementation.

    Given the above two statements here’s my thinking:

    Signals don’t have an implementation but declaring it pure virtual will require the inheriting class to provide an implementation… which directly conflict with “signals don’t have an implementation”. It’s like asking someone to be in two places at once it’s just not possible.

    So in conclusion it seems like declaring a “pure virtual” “signal” should be an error and thus not valid.


    In the case of an abstract base class here’s what I think is correct:

    When one declares the function only “virtual” it still gives the warning. To avoid any warnings I think the solution is to not qualify the signal with any “virtual” or “pure virtual” and then the inheriting class will not declare any signals but can still emit the signals defined in the base class.

    [1] when I say that “signals don’t ever have an implementation” I mean that the person implementing the class doesn’t provide the implementation. I understand that behind the scene Qt’s moc provides an implementation in the moc_FILE1.cpp .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a base class which contains an abstract/MustInherit method. I want this method
Is a public constructor in an abstract class a codesmell? Making the constructor protected
I have an abstract immutable base class that defines enforces child classes to be
I am making some abstract base classes. The base object is defined as: public
After making an abstract superclass, when you get to the first concrete subclass, you've
I am making an abstract class to ease up handling of properties. Now I
A base project contains an abstract base class Foo. In separate client projects, there
I have an abstract base class which acts as an interface. I have two
I need to abstract away a lot of the interface from a base class
I have a base class and it has virtual functions. The issue is that,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.