Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Demo-Class
A Simple C++ Class
Class: A class in C++ is the building block, that leads to Object-Oriented programming. It is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A C++ class is like a blueprint for an object.
42 changes: 32 additions & 10 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
//complete me

#include <iostream>
using namespace std;


int main()
{

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

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

// Data Members
string coder;

// Member Functions()
void printname()
{
cout << "Geekname is: " << coder;
}
};

int main() {

// Declare an object of class geeks
Geeks obj1;

// accessing data member
obj1.geekname = "Abhi";

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