why we did . balance we did not learm this type of thing till the course
Why we did heightbalanced ( root).balance
Hey @Aditya-Kushwaha-914550392281281,
If you are asking about the dot operator we have used to access the public members of the class:
This is just another way of accessing class members using the object of the class.
Let’s understand the difference with the help of an example:
class car{
public:
string name;
};
-
if you are creating a pointer to an object of a class i.e.
car *c= new car;
then, you use “->” operator to access the members like:
c->name=“Swift”; -
if you are creating an object of a class i.e.
car c;
then, you use “.” operator to access the members like:
c.name=“Swift”;
Hope, this would help.
Give a like if you are satisfied.