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.
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?
Subreddit
Post Details
- Posted
- 5 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/AskProgramm...