You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
Well, an ugly solution for an ugly problem: Your examples are the prime motivation for the introduction of virtual inheritance in C++. Behind all these facades is always just a single person. In fact, this may be the best rationale for virtual inheritance I've read in a while (I didn't understand Stroustrup's reasoning, for example). So you could "compose by (multiple) inheritance" ;-).Peter - Reinstate Monica– Peter - Reinstate Monica2022-02-16 16:39:34 +00:00Commented Feb 16, 2022 at 16:39
-
Many TAs and some teachers are Phd students. And what about Student-teachers? We don't need to look vey far for real examples of this.JimmyJames– JimmyJames2022-02-16 18:18:05 +00:00Commented Feb 16, 2022 at 18:18
-
@Peter Virtual inheritance doesn't solve this. If you have two objects inheriting the same person, you have two instances of the same person, whether virtual or non-virtual inheritance. What you need is that Teacher, Student etc. hold a reference to the same Person object.gnasher729– gnasher7292022-02-16 19:24:46 +00:00Commented Feb 16, 2022 at 19:24
-
@gnasher Hm, true, I had in mind to have a class hierarchy student:virtual public person and a teacher:virtual public person and then create a teaching_student:teacher,student which would have only one person subobject. But composition is much better because it could change roles dynamically.Peter - Reinstate Monica– Peter - Reinstate Monica2022-02-16 20:50:59 +00:00Commented Feb 16, 2022 at 20:50
-
1The truth, the whole truth and nothing but the truth, so help me Coddmcalex– mcalex2022-02-17 09:09:18 +00:00Commented Feb 17, 2022 at 9:09
Add a comment
|
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you