a1
is an uninitialized pointer. It does not point anywhere. Using it causes undefined behaviour.
You can only dereference pointers that point to valid objects.
In your sample code there is actually no way to create a saa
since it has protected constructors. You would have to derive a class from saa
, create an instance of that, and then make a1
point to that instance.
0
solved Segmentation Fault calling a member function [closed]