Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
507 B
7
Indexable
Never
// 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;
}
Leave a Comment