WAP in C++ that initializes a class ratio with no parameters as a default constructor and add a parametrized constructor that initializes the declared object. Constructor must initialize the object & the output should print the ratio as per the constructor.
Answers
Answered by
0
Answer:
C++ constructors are special member functions which are created when the object is created or defined and its task is to initialize the object of its class. It is called constructor because it constructs the values of data members of the class.
A constructor has the same name as the class and it doesn’t have any return type. It is invoked whenever an object of its associated class is created.
When a class is instantiated, even if we don’t declare a constructor, compiler automatically creates one for the program. This compiler created constructor is called default constructor.
Explanation:
hope it help u.
plz make me a brainlists.
and follow me i will follow u back.
Similar questions