+ 1
Why we use constructor in oops ?
in c++ i can access the member function by creating simple object then why we need to create constructor.
2 odpowiedzi
+ 4
actually constructors are so usefull sometime we need to create some object which require some input without it the operation will not successfully execute.
ex: suppose we are working with graphics then we need a class of Point but with no constructor it is useless,thus must provide a constructor with (int x,int y) values so whenever someone makes an object of this class it will ask for the x & y values.
0
Great thanks