Question on base class access spec. and constructor

In summary: DerivedClass.h fileclass DerivedClass : public BaseClass{public:DerivedClass(int x){x=0;}public int... y(){return x+y;}};In summary,The main point of private or protected inheritance is to restrict access to the base class portion of the derived class. If that is the case, it's back to square one. DerivedClass.h include BaseClass.h, then if outsider programs put #include "BaseClass.h", they can directly access to all the public members of BaseClass. Then what is the point of DerivedClass to declare class DerivedClass : private
  • #36
jbunniii said:
The best way to learn C++ beyond the basics is to use C++ by writing programs of your own, and/or modifying other people's programs, e.g. by adding new features.

Since you're working on your own as opposed to being employed in a software organization, a great way to proceed would be to find an interesting open source project. Make a local clone, read through the source code, look up stuff in books or online (cppreference is a good web site) until you understand how it works, then try adding some small features.

This way any future learning will be motivated by a specific need as opposed to just reading through an encyclopedic reference such as Stroustrup. In my experience, this is a much more efficient way to learn new language/library features than simply reading about them.
Thanks for the suggestion, I'll look into that. Where do you find those open source projects?

I even thought about looking for a jr. programmer position in firmware type using my experience in hardware design. But the idea of committing to a full time job is kind of unthinkable. Too bad they don't have part time job like this. I don't even mind low wages, just not full time.

Yes, I want to do something with the things I learn, not keep learning and learning. I want to practice with what I learned. It is so dry learning chapter after chapter like in the last 6 months. I think at the minimum is to start on the gaming and graphic book by Gaddis, I looked at it a little, it doesn't sound like they need deep knowledge on C++ as they only talked about Class and Inheritance in the last chapter or two.

Thanks
 
Technology news on Phys.org
  • #37
Source code for a fair share cooperative/open source projects is on github. Usually there is parent site possibly with forums, email, or some other communication format.

For example I worked for short while on rootkit hunter - rkhunter. It is coded in perl and is not very active, last update in 2018. In my experience too many of these projects are not actively supported.

Others, very few, become standard parts of Linux or building blocks for specialty tools. Cygwin is an example of this. It emulates Linux/UNIX and sits on the Windows runtime. So you get a UNIX interface for your windows box. It is free and is still open source.
 

Similar threads

  • Programming and Computer Science
2
Replies
36
Views
2K
  • Programming and Computer Science
2
Replies
36
Views
3K
  • Programming and Computer Science
Replies
23
Views
2K
  • Programming and Computer Science
2
Replies
35
Views
2K
  • Programming and Computer Science
2
Replies
36
Views
2K
  • Programming and Computer Science
Replies
31
Views
2K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
3
Replies
89
Views
4K
  • Programming and Computer Science
Replies
9
Views
1K
Back
Top