Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include<iostream> using namespace std; class student{ public: string stdname; int id; void printname(); void printid() { cout << "ID is:" <<id; } }; void student::printname(){ cout << "Name of stud is :"<<stdname; } int main() { student obj1; obj1.stdname = "onkar"; obj1.id = 1000111; obj1.printname(); cout <<endl; obj1.printid(); return 0; } /* // C++ program to demonstrate function // declaration outside class #include <bits/stdc++.h> using namespace std; class Geeks { public: string geekname; int id; // printname is not defined inside class definition void printname(); // printid is defined inside class definition void printid() { cout << "Geek id is: " << id; } }; // Definition of printname using scope resolution operator :: void Geeks::printname() { cout << "Geekname is: " << geekname; } int main() { Geeks obj1; obj1.geekname = "xyz"; obj1.id=15; // call printname() obj1.printname(); cout << endl; // call printid() obj1.printid(); return 0; } */
Editor Settings
Theme
Key bindings
Full width
Lines