OOP

object in OOP(Object oriented Programming)

An object is an entity or instance of class. each object has properties and behaviors.

Example

// C++ program to demonstrate
// accessing of data members

#include <bits/stdc++.h>
using namespace std;
class Geeks
{
// Access specifier
public:

// Data Members
string geekname;

// Member Functions()
void printname()
{
cout << “Geekname is: ” << geekname;
}
};

int main() {

// Declare an object of class geeks
Geeks objName;

// accessing data member
objName.geekname = “zee”;

// accessing member function
obj1.printname();
return 0;
}

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny