write a program for function overloading?

Answer Posted / abhinav kr

#include<iostream.h>
#include<conio.h>
void printline();
void printline(char ch);
void printline(char ch,int n);
void main()
{
printline();
printline('$');
printline('$',5);
}
void printline()
{
clrscr();
for(int i=1;i<=5;i++)
cout<<"*"<<endl;
}
void printline (char ch)
{
for(int i=1;i<=5;i++)
cout<<ch<<endl;}
void printline(char ch,int n)
{
for(int i=1;i<=n;i++)
cout<<ch<<endl;
getch();
}

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism and example?

592


Why polymorphism is used in oops?

583


Which method cannot be overridden?

578


What is a superclass in oop?

667


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2575






Can a varargs method be overloaded?

617


What is difference between class and object with example?

562


Why multiple inheritance is not possible?

598


What is polymorphism what are the different types of polymorphism?

566


What is class encapsulation?

589


What is use of overloading?

608


What is protected in oop?

604


What is encapsulation in simple terms?

537


What is encapsulation in oops?

534


Get me a number puzzle game-program

1694