类的hello,world
写类的hello,world程序 如下
#include <iostream> using namespace std; #include <string.h> class A{ protected: string a; public: A(){ a ="hello,world"; } string get_a(){ return a; } }; class B : public A{ }; int main(){ B b; cout<<b.get_a()<<endl;; }