some more
This commit is contained in:
23
OOP/simple.cpp
Normal file
23
OOP/simple.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/* So basically a class is a template for data you can use anywhere ; so here you can def myVar to a int and a string to mystring and later output
|
||||
that into a Object of that class (marked later in program)
|
||||
*/
|
||||
class MyClass {
|
||||
public:
|
||||
int myVar;
|
||||
string myString;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
MyClass classobj1;
|
||||
classobj1.myString = "You*re gay";
|
||||
classobj1.myVar = 25565;
|
||||
|
||||
cout << classobj1.myString << "\n" << classobj1.myVar;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user