Prevent changes to derived c++ classes

I have a parent C++ class and multiple derived C++ classes attached to that one C++ class is there anyway to change the variables withing the constructor of the parent c++ class without affecting the derived c++ classes? Or being able to create static mesh components without affecting the derived c++ actors. I wanted to place an attachment on a gun that is the parent class of alot of derived c++ classes and that attachment transferred to the other derived classes as well.

I’m new to programming.

I think you could put everything in a function on your parent class and override that function in the child classes.
If you don’t call the Super on your child class, then the parent stuff won’t run.

The problem is that my other actors share the 1 parent class mesh so if I affect that mesh inside of the parent class all of the other meshes become affected regardless it seems. I am affecting the begin play function.

I have tried what you have said the editor crashes.

I just don’t know if it is possible to affect the mesh inside the parent class and prevent that same mesh from being affected inside of the child classes.

If you’re changing the parent mesh with a function, try making this function virtual, create an override function in the child class, and leave the implementation empty. When this function gets called by the parent class, the overridden function in the child class will do nothing, but the parent function will change your parent mesh.

Edit:: yeah, that’s exactly what @ugmoe said. Excuse my inattentiveness.

When the editor crashes, what’s the error?