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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:51:49+00:00 2026-06-07T02:51:49+00:00

When using interfaces in c++; You have your abstract (parent) class. Then you have

  • 0

When using interfaces in c++; You have your abstract (parent) class. Then you have the child class which inherits from the parent class and implements the pure virtual functions.

When another class uses the (child) interface, what is the point in the abstract class at this point? If you try to use the parent type in a function, i.e returning the type Parent, you get compiler errors (presumably because the compiler doesn’t know how much memory to allocate).

Can anyone tell me how to do the above?

i.e

Parent = Shape.
Child = Rectangle.
Thrid class which contains method which returns the type Shape?

Thanks in advance for any help/information.

  • 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-07T02:51:51+00:00Added an answer on June 7, 2026 at 2:51 am

    A big advantage is that all children share the same interface. If you have a second child inheriting from the parent (Child = Circle), then regardless of the specific subclass, both of them can use the same functions.

    Imagine then that you have a vector with pointers to shapes (vector < Shape* >), then it doesn’t matter which shapes you have in the vector, if your base class Shape has a virtual method Draw(), you can use that method from each element of the vector without explicit knowledge how that Draw method is implemented.

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

Sidebar

Related Questions

I am using Moq framework for Mocking. I have a SocialWorker which derives from
I am trying to implement my persitent classes using interfaces. I have created the
I have previously written user interfaces using .NET and Windows Forms. I'm about to
I have created a UISegmentedControl with two segments using the interface builder (from storyboard),
I have built my interface by using ViewStubs, which I inflate during onCreate. But
I have a class that implements an interface, and that interface extends another interface.
I have an existing database, which I have been happily accessing using LINQtoSQL. Armed
Using Visual Studio I have a Class Library (C#) where I added a reference
Using online interfaces to a version control system is a nice way to have
I have registered javascript under portal_javascript using the answer 1 from How to Disable

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.