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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:19:03+00:00 2026-06-01T04:19:03+00:00

So, clearly I’m doing something wrong… #include <iostream> using namespace std; class thing1 {

  • 0

So, clearly I’m doing something wrong…

#include <iostream>
using namespace std;

class thing1
{
public:
    void thingTest()
    {
        cout << "I AM THING 1\n";
    }
};

class thing2: public thing1
{
public:
    void thingTest()
    {
        cout << "I AM THING 2\n";
    }
};

void DoStuff( thing1 temp )
{
    temp.thingTest();
}


void main()
{
    DoStuff( thing2() );
}

I expect this code to output:

I AM THING 2

but instead I get:

I AM THING 1

the “final” goal of this project is to create a LinkedList of classes that store tasks in the form of void WorkClass.Do( void ). Each inharted class would be a different task (most of them have to do with rendering interface with my graphics engine). I want to EnQueue the constructor, then when DoWork() is called, DeQueue WorkClass.Do() until I hit a null pointer.

I figured being able to do this simple thing would be a good start to making all that other stuff work… but as it is, I’ve hit a brick wall. I assume I’ll have to do something with pointers…

  • 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-01T04:19:05+00:00Added an answer on June 1, 2026 at 4:19 am

    You are taking them by value, which is slicing them. You must use reference or pointer (reference to const, or rvalue reference, in this case as they are rvalues)

    Note the use of the virtual keyword. It is only needed on the method declaration in the base class- inherited members which are virtual are virtual by default.

    A fixed version on ideone.

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

Sidebar

Related Questions

Clearly I'm doing something stupid. processTextNodes: function processTextNodes(node) { node = node || content.document.body;
I'm clearly missing something here. I need to fill methods of dynamic AS3 class
Is it possible to clearly identify a class of variable? something like: @users.who_r_u? #=>Class
Can somebody please explain me clearly by using some nice examples how c++ class
Clearly I must not be doing something right but this happens on random occasions.
Can someone clearly explain me how these functions of heap sort are working?? void
Clearly these are a class, right? But I can't find any javadoc api's on
I'm clearly missing something here... I have a generic list of objects and I'm
Following is clearly mentioned in java docs about java.text.NumberFormat class :- setParseIntegerOnly : only
Clearly I am missing something important about stringstreams in general here, but could someone

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.