i was writing a class like this
class AA{
private:
char* str;
public:
AA(int size){
str = (char*)malloc(size);
}
};
int main(){
AA anAA(1000);
}
here is the problem, when the size is too big it may cause malloc return a 0 pointer, if the str init fail, is there any method to return a 0 pointer to anAA(in the main entry point, i can check anAA isn't init success by if(anAA != NULL)), i don't want to make a function for creating AA class, or make a check function in the class