Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
property get set
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//g++ 5.4.0 #include <iostream> using namespace std; class Test{ int value; string name; public: Test(){} Test(int value, string name) :value(value), name(name){} // this->value = value // this->name = name void setName(string name){ this->name = name; // this->name != name } string getName(){ return name; // name == this->name } void setValue(int value){ this->value = value; // this->value != value } int getValue(){ return value; // value == this->value } }; int main() { Test test1; test1.setValue(123); cout<< test1.getValue() <<endl; // 123 Test test2(123,"abc"); cout<< test2.getValue() <<endl; // 123 test2.setValue(456); cout<< test2.getValue() <<endl; // 456 }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.43 sec, absolute running time: 0.15 sec, cpu time: 0.09 sec, memory peak: 3 Mb, absolute service time: 0,58 sec
fork mode
|
history
|
discussion
123 123 456
stackse - search stackoverflow differently