Bing In

Bing In

  • NA
  • 30
  • 9k

change C++ code into C#

May 14 2016 12:13 AM
change the code below into C sharp code 
result must be the same 
 
 

 
 
class CA {
public: CA(int a) { a_data = a; }
protected: int a_data;
};
 
class CB : public CA {
public: CB(int b);
            void display();
private: int b_data;
};
 
CB::CB(int b) : CA(b) { b_data = b; }
void CB::display() {
      cout << "a_data = " << a_data << "\n";
      cout << "b_data = " << b_data << "\n";
}
 
void main() {
CB a(1);
a.display();
CB b(3);
b.display(1);

Answers (1)