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 7603377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:38:26+00:00 2026-05-30T23:38:26+00:00

class Parent { public: void func1(); // Complete meaningful definition in parent given. virtual

  • 0
class Parent {
public:
    void func1(); // Complete meaningful definition in parent given.

    virtual HRESULT func2()=0;  // Bcoz of this function Parent class is abstract. 
};


class Child: public Parent {
public:
    void func1(); // Different definition in child.
};

Is this possible in C++ ? I am overriding func1() which is NOT virtual and it already has a definition in parent abstract class.

  • 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-05-30T23:38:27+00:00Added an answer on May 30, 2026 at 11:38 pm

    [assuming here Child extends Parent, unlike what the code snap shows]

    Yes it is possible [it is called hiding] – but you will not get a dynamic dispatch behavior.

    The static type will define which method will be invoked, and not the dynamic type.

    For example:

    Parent* p = new Child;
    p->func1();
    

    Will invoke Parent::func1()

    while:

    Child* c = new Child;
    c->func1();
    

    Will invoke Child::func1()

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

Sidebar

Related Questions

I have a super class like this: class Parent { public: virtual void Function(int
class GrandParent { public virtual void Foo() { ... } } class Parent :
The following code: #include <stdio.h> class Parent { public: virtual void func() {printf(Parent\n);} };
Lets say I have a parent Class: Class Parent{ public: virtual void doSomething(){} }
I've got a class that looks something like this: public class Parent { public
This is my MDI Parent. public partial class frmMain : Form { public Options
Consider this code sample: public abstract class Parent { public int val; public Parent()
class Parent{ }; class Child: public Parent { } void Func(Parent*& param) { }
class Child; class Parent { public: void (*funcPointer)(); void (*funcPointer2)(Parent* _this); void (Child::*funcPointer3)(); };
class Parent { private void method1() { System.out.println(Parent's method1()); } public void method2() {

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.