Strings, Functions, Scope Resolution, Access Control, Function Ambiguity with Default values


#include<iostream>
#include <string>

using std::cout;
using std::endl;
using std::cin;
using std::string;
using std::getline;

void test1();
void test1(int x, int y, int z);
void test1(int x, int y, int z, int);

class A
{
public:
      /* void test1(){
            cout<<"test1"<<endl;
            }*/ 
        void test1(int x=1, int y = 5, int z=8){
             cout<<"x y z"<<endl;
             }  
            /* 
              void test1(int x = 1, int y=2, int z=3, int a=4){
              cout<<"x=1 y=2 z=3 a=4"<<endl;
             }      
             */
           
private:
       void test2(){
            cout<<"test2"<<endl;
            }      
};


int xx;

 int main()
{
       int x=50;
       char y = 7;
    A bb;
    //.test1();
    //bb.test1(77,88,99);
    bb.test1();
    
    char z;
   // cin>>z;
    //cout<<z;
    
    string name;
    getline(cin, name);
    cout<<name;
     

system("pause");   

return 0;
}

Advertisements

About praveenaj

I'm just an average guy who enjoys doing Programming/Web Designs/Pencil art & drinking coffee :)
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s