Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6006019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:28:48+00:00 2026-05-23T01:28:48+00:00

I have another rudimentary question. I somewhat recall hearing that everything in C++ goes

  • 0

I have another rudimentary question. I somewhat recall hearing that everything in C++ goes inside a class. Then I hear that classes shouldn’t be used where possible. So my question goes: When do you make classes and when do you not? (an example or two would be cool)

And a random side-question: When is it appropriate to put 2 classes in one header? Or does it matter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:28:49+00:00Added an answer on May 23, 2026 at 1:28 am

    In C++ everything need not go inside a class(as opposed to Java where everything does go inside a class).

    1. You should make a class when you want to represent some real world entity for example a person, a customer, an user, animal, car etc. You require to store some data about the entity and have some functions related to the entity.

      For Example: Customer. You create a customer class. Customer has the following data to be stored. {name,age,address,phone}. You need some functions like addCustomer(), sendMessage() etc.

    2. Choice of where to use classes and where not to is a serious design issue. There is no general rule. Before you begin your application, you need to sit down with a paper and pencil and brainstorm the basic classes you will be requiring. You can always add and fine tune your design in the future. While designing your classes the most important thing to be kept in mind is code re-usability. Also try to keep your code as loosely coupled as possible.

    3. As a standard practice, you should have one class per header file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some rudimentary question about inheritance in C#. I have two classes. I
I have another question. XMLhttpRequests haunt me. Everything is now in the database but
I have another question for you. I have a python class with a list
I have another WPF databinding question... one that I haven't found an answer to
I have another beginner's question that hopefully someone can help with. I'm trying to
I have another question. Quite similar to the other that i already asked (and
I have another newbie Python question. I have the following piece of code that
I have an XElement and inside that element I have another XML fragment. How
I have another question for you that I believe I already know WHY it
I have another simple question about Node. I'm trying to make a simple http

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.