0

Can we have one class object created and then append the values to its object?

Hi Refer code below: https://www.sololearn.com/en/compiler-playground/cYUOt0dCYvE4 I know there are lot of static methods and raw pointer, but I cannot have control to modify it. My query is related to logger class. It has only one member variable of string type, but I need its multiple values. I can easily create vector<string> and store values into it. But how to store different objects into one object? Currently, loggerNamespace::AddToLog("Ketan 1"); create first object and all three other calls create another three objects. Can we have some mechanism to create it for first time and then don't create it but append to it? https://sololearn.com/compiler-playground/cYUOt0dCYvE4/?ref=app

12th Feb 2024, 9:46 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
+ 2
Ketan Lalcheta your constructs are always so complicated..... are circular dependencies really unavoidable? how about vectors and initializer_list? https://sololearn.com/compiler-playground/cC5c82yrTILf/?ref=app
14th Feb 2024, 1:16 AM
Bob_Li
Bob_Li - avatar
0
Yes
12th Feb 2024, 12:58 PM
Nirmit
Nirmit - avatar
0
Could not get you
12th Feb 2024, 1:07 PM
Ketan Lalcheta
Ketan Lalcheta - avatar