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

  • Home
  • SEARCH
  • 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 8850773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:58:43+00:00 2026-06-14T12:58:43+00:00

Suppose I have the following code: class Iinterface { virtual void abstractFunction()=0; }; class

  • 0

Suppose I have the following code:

class Iinterface
{
  virtual void abstractFunction()=0;
};

class Derived : public Iinterface
{
  void abstractFunction(); // Do I need this line?
};

Derived::abstractFunction()
{
  // implementation here
}

If I don’t add the line in question, I get compile error which says abstractFunction is not declared in Derived. I’m using VS 2008.
I’m not sure why I need this particular line (do not confuse this with the function definition which is provided outside class declaration), as long as I’m inheriting from Iinterface it should be obvious I have abstractFunction declared. Is that a problem with visual studio or is it enforced by c++ standards?

  • 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-14T12:58:45+00:00Added an answer on June 14, 2026 at 12:58 pm

    If the declaration of pure-virtual base functions were implied in all derived classes, then you could never have a derived class that remains abstract with respect to a pure-virtual base function. Instead, all derived classes would produce linker errors. That would be extremely counter-intuitive and confusing, and it would make the language less expressive.

    Moreover, it wouldn’t even make sense: The question whether the derived class is abstract or not must be known everywhere at compile-time. The implementation of the overrider is typically only provided in one single translation unit, so it would be impossible to communicate the fact that you actually mean for the function to be overridden to the rest of the program.

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

Sidebar

Related Questions

Suppose I have the following code: class a { public: virtual void do_a() =
Suppose I have the following code: namespace x{ class X{ virtual void x(){} }
Suppose I have following code package memoryleak; public class MemoryLeak { public static int
Say suppose I have the following Java code. public class Example { public static
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
Suppose I have following code: public class CBase: AbstractC,IRenderable { //code here } public
Suppose we have following two classes: class Temp{ public: char a; char b; };
Suppose I have the following Scala code: class Foo(a: Int) class Bar(b: Buffer[Int]) extends
gcc 4.5.1, SuSE Linux i686 Suppose we have following code: template<typename realT> class B
I have the following code working in Silverlight 5: public void Send(Notification notification) {

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.