Building derived class on an Existing Class:

Hello all,
I have a question and I'm certain this is the right place for asking. I'm beginner in c++. I'm so curious to learn everything about this language. I've a lot of projects in my mind. So, I'm reading schaum's series for C++.

My question is while I'm reading this book step by step line by line, I reached this example. Building classes then derived classes. How can I add derived class from a class which is already existed. In other words, I have Person Class (which is my base class) and after implementing this class, I would like to create Student Class ( which is my derived class). How can I do that from using Solution Explorer window? I can add base class and derived class together by right click on my project and then add new item then adding class + base class I know that but what if my class in this case existed and I want only to add base class? I know how to add cpp. file and h. file but I want to take advantage of using the formal style if it exists in this case.

Forgive my ignorance. I'm just building my experience and not jumping to advanced level without understanding the basics. No Pain No Gain.
thanks in advance.
you should go study some books
just provide a simple example base on your title

class A{};

class B : public class A{};

base on your question
class Person{};

class Student : public class Person{};

did you know why i set to public?
if i set to protected or private
can you tell what is the difference between them?
Thanks for your helping. Now I'm reading and probably it takes me a while to be familiar with the language. Anyway, I know what does public mean, it affects how the members of the base class will be accessed by the member functions of the derived class.

I'm not sure if you understood my question or I didn't explain it properly. Never mind, I solved it. I prefer to separate h. file and cpp. file. The book I'm reading doesn't separate them. It puts all classes in main file. I know this works with simple classes, but I prefer to separate them even if they are simple. It's kind of practice. I'm not sure if it is right practice, however, it makes sense to me.
On my system KDevelop on Linux, I use the class wizard, which (amongst other things) creates separate files, and stubs for constructors etc. I can make a declaration of a function in the header file, and it will create a stub in the .cpp file. It will do the right thing when you specify a base class.

You should be able to do something similar in your system - with any luck. Read the help on your system, or try to find a tutorial somewhere.

Thank you so much. Yes, actually I did figure it out.
Topic archived. No new replies allowed.