0
How to add a variable into a class which is not defined in the class. I want to add it after creating the class.
class Car { string color = "red"; } After creating the class I want to add some more variables. For example : int weight =256; int speed= 234; I want to add these variables in the car class. How can I do it?
3 Answers
0
Can I add those variables while creating a object?
0
But what's a problem to declare them directly inside the class?