How to the Accessing of multiple Members Function of a class In C++


#include<iostream> using namespace std; class MyClass{ public: void msg1(){ cout<<"Welcome to Codeverb"<<endl; } void msg2(){ cout<<"What are you doing with your life!"<<endl; } }; int main(){ MyClass s; s.msg1(); s.msg2(); return 0; }

Output:-

Welcome to Codeverb
What are you doing with your life!

Explanation of the program

Here the class has 2 member function, both public. The object 's' accesses both these members function.