We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
make the definition of get_price() function to -> virtual int get_price() , meaning it can be overridden by derieved class if it got a function definiton in it but default definition is used when no function definition.
Thats y when no virtual is used, it returns 50*1 + 1*100 = 150 leading to 250+ 150= 400 but when virtual is used, overriding takes place -> in derieved class 50*bedrooms + 100*bathroom + 100 = 500
Hotel Prices
You are viewing a single comment's thread. Return to all comments →
make the definition of get_price() function to -> virtual int get_price() , meaning it can be overridden by derieved class if it got a function definiton in it but default definition is used when no function definition. Thats y when no virtual is used, it returns 50*1 + 1*100 = 150 leading to 250+ 150= 400 but when virtual is used, overriding takes place -> in derieved class 50*bedrooms + 100*bathroom + 100 = 500