how would I go about making a variable in a class, that could be read directly but not written as such?


is allowed but class1.variable = true; is not...
however I don't want a const , I want it to be able to be set from within the class, just not directly. How would I do this?

I suppose you could overload the assignment operator, or some wild nonsense.... why not just make a getter method, and properly encapsulate the variable?

"encapsulate" the variable?
And do you mean like,

bool class1::class1.variable(){
    return variable;

Pretty much.

class AClass
    private: /*or protected, depends on your needs*/
                bool truth;
                bool return_truth();
bool AClass::return_truth()