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 8795651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:26:06+00:00 2026-06-13T23:26:06+00:00

This one class I have has only protected variable attributes like int health and

  • 0

This one class I have has only protected variable attributes like int health and int level, but no methods. Is this bad practice? I am using this for a save game function and it only needs to use variables, but requires no methods. The files look like this:

Human.h:

// Human.h - Johnny P

#pragma once

namespace SharpEngine {
    class Human {
    protected:
        std::string name;
        int level;
        int health;
        int defense;
        int strength;
        int experience;
        int money;
        int inventory[10];
    };
}

Human.cpp

// Human.cpp - Johnny P

#include <string>
#include "Human.h"
  • 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-06-13T23:26:07+00:00Added an answer on June 13, 2026 at 11:26 pm

    Well, “bad practice” is a somewhat laden term.

    Let’s rather say that a common pattern is “Dumb Data” where the class/struct is just there to contain the data. This is not quite the same as “Plain Old Data” (POD), which is a C-compatible struct.

    Having said that, using “protected” is not typical of a Dumb Data pattern. In using “protected” you imply that you will derived from it, which then implies at the very least a virtual destructor.

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

Sidebar

Related Questions

I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I have a class that contains a boolean field like this one: public class
I can't figure out why I'm getting this error. I only have one class
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
Assume I have a Class Foo which has many internal variables, only one constructor
I have this one class: say InterClass . This class is declared in say,
i make one class file for jar. and this class have use wurfl. and
I'm a Java-beginner, so please bear with this one. I have a class: class
i have one single class for margin and i am using this class to
I have a relationship like this class User include Mongoid::Document include Mongoid::Timestamps embeds_one :setting

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.