A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C++ program to create a simple class and object
Q:

C++ program to create a simple class and object

0

C++ program to create a simple class and object

In this program you will learn how to create a class, create object of that class and calling the member function in main function.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Simple class and object creating program in C++

/* C++ program to create a simple class and object.*/

#include  <iostream>
using namespace std;
 
class Hello
{
    public:
        void sayHello()
        {
                cout << "Hello World" << endl;
        }
};
 
int main()
{
    Hello h;
     
    h.sayHello();
     
    return 0;
}

Output

Hello World

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now