Constructor Overloading Simple Program C++ - HelpMeOutAlways

Monday, November 26, 2018

Constructor Overloading Simple Program C++


Source Code

#include<iostream>
#include<string>
using namespace std;
class Bank{
private:
int intialBal;
string type;
public:
Bank(int x){
intialBal=x;
cout<<"Initial Balance in your account is="<<intialBal;
}
Bank(string x){
type=x;
cout<<"\nAccount type="<<type;
} };
int main(){
Bank obj(500),obj2("Saving Account");
return 0;
}

Output

constructor overloading c++ by helpmeoutalways

No comments:

@way2themes