Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services. C++ Classes and C++ object orriented programing and C++ OOP | C++ Tutorials Bestitworrior
Tips and Software development services. C++ Classes and C++ object orriented programing and C++ OOP | C++ Tutorials Bestitworrior
C++ object orriented programing
Some Key Points of C++ Class
- Class Use to define the object
- OOP stands fro object oriented programing
- Object define as any thing which have some properties and functions
- Class have some propertis known as data members
- Class have some methods to perform some actions
- Class have access specifier know as Public , Private , Protected
- Object use to access the class properties and set values or calling the member function of class .
- Polymorphism means "many forms" it means that occure when we have classes that are relate to each other by inheritance.
Code
# include<iostream>
using namespace std;
class FirstClass {
public:
int num;
string strn;
public:
MyClass()
{
cout << "Constructors";
}
public:
void myMethod()
{
cout << "Method Call";
}
};
int main()
{
FirstClass myObj;
myObj.num = 15;
myObj.strn = "Some text";
cout << myObj.num << "\n";
cout << myObj.strn;
cout << endl;
myObj.myMethod();
return 0;
}
Output
15
Some text
Method Call
Some text
Method Call
0 Comments