Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
Error: a non static member reference must be relative to a specific object
Post Flair (click to view more posts with a particular flair)
Post Body

In C , how to you avoid "a non static member reference must be relative to a specific object" error when calling a function from a derived class in a base class without creating an instance of the derived class or make the function in the derived class static?

Basically, I'm asking if there are ways around this. I'm thinking of creating a copy constructor in base where I can pass the instance of derived class by reference but I'm not sure if this is possible.

I've the instance of the derived class in my int man function and I don't want to create another derived class instance in my class header file.

Can I use a base class pointer to the address of the derived object?

Author
Account Strength
90%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,330
Link Karma
2,810
Comment Karma
1,507
Profile updated: 4 days ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 months ago