Timeline for Derived class cannot access the protected member of the base class
Current License: CC BY-SA 4.0
21 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 12, 2018 at 4:37 | audit | Triage | |||
Sep 12, 2018 at 4:59 | |||||
Sep 7, 2018 at 1:03 | audit | Triage | |||
Sep 7, 2018 at 1:03 | |||||
Sep 5, 2018 at 7:30 | audit | Triage | |||
Sep 5, 2018 at 8:11 | |||||
Sep 2, 2018 at 7:35 | audit | Triage | |||
Sep 2, 2018 at 7:36 | |||||
Aug 29, 2018 at 19:50 | audit | Triage | |||
Aug 29, 2018 at 20:10 | |||||
Aug 28, 2018 at 6:29 | audit | Triage | |||
Aug 28, 2018 at 6:45 | |||||
Aug 26, 2018 at 9:06 | audit | Triage | |||
Aug 26, 2018 at 9:07 | |||||
Aug 13, 2018 at 14:55 | review | Close votes | |||
Aug 17, 2018 at 0:05 | |||||
Aug 13, 2018 at 14:47 | comment | added | Sebastian Redl | That's why I didn't. | |
Aug 13, 2018 at 14:46 | comment | added | 463035818_is_not_an_ai | @SebastianRedl I get your point, though i dont think it is that obvious that this applies here, thus I wouldnt flag it as exact duplicate | |
Aug 13, 2018 at 14:46 | history | edited | songyuanyao |
edited tags
|
|
Aug 13, 2018 at 14:43 | vote | accept | Novice_Developer | ||
Aug 13, 2018 at 14:38 | comment | added | rustyx | Possible duplicate of Accessing protected members in a derived class | |
Aug 13, 2018 at 14:36 | comment | added | Sebastian Redl | @user463035818 The reasoning is the same though. You try to access a protected member through an access path that is not your class. Which is why songyuanyao's answer works. | |
Aug 13, 2018 at 14:34 | answer | added | nvoigt | timeline score: 0 | |
Aug 13, 2018 at 14:34 | answer | added | songyuanyao | timeline score: 13 | |
Aug 13, 2018 at 14:32 | comment | added | 463035818_is_not_an_ai | @SebastianRedl the question you link is about calling a protected method on another instance, which isnt exactly the case here | |
Aug 13, 2018 at 14:30 | comment | added | Simion | why to not use just : g = &x; ? | |
Aug 13, 2018 at 14:30 | comment | added | Sebastian Redl | Does stackoverflow.com/questions/477829/… answer your question? It's very similar. | |
Aug 13, 2018 at 14:28 | comment | added | Tim Randall |
Well, the constructor of derived is private, so the class will be tricky to use, but I don't think that's the problem. Why not try it using a simpler access? For example, a derived class function that just returns x (Hint: you won't need to specify base:: to access it)
|
|
Aug 13, 2018 at 14:24 | history | asked | Novice_Developer | CC BY-SA 4.0 |