Untitled
unknown
c_cpp
2 years ago
507 B
11
Indexable
// Online C++ compiler to run C++ program online
#include <iostream>
#include <string>
using namespace std;
class example{
public:
example(const string& iname, int s = 5)
{
itemname = iname;
int size =s;
data = new int[size];
count++;
}
string getstr(){
return itemname;
}
private:
string itemname;
int size;
int* data;
static int count=0;
};
int main() {
example ex1("abc");
cout << ex1.getstr();
return 0;
}Editor is loading...
Leave a Comment