Monday, May 9, 2022

Can we pass class objects as function arguments? Explain with the help of an example.

 #include <iostream>

using namespace std;
class a
{
public:
    void show()
    {
        cout << "hello\n";
    }
    void show2(a A)
    {
        A.show();
    }
};
int main()
{
    a A,b;
    A.show2(b);

    return 0;
}
//first one is using method
#include <iostream>
using namespace std;
class a
{
public:
    void show()
    {
        cout << "hello\n";
    }
   
};
void show2(a A)
    {
        A.show();
    }
int main()
{
    a A;
   
    show2(A);

    return 0;
}
//this one is using function


No comments:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...