Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.46 KB, 2 trang )
Chapter 12 Quick Reference
To Do this
Create a derived
class from a base
class
Declare the new class name followed by a colon and the name of the
base class. For example:
class Derived : Base
{
...
}
Call a base class
constructor
Supply a constructor parameter list before the body of the derived
class constructor. For example:
class Derived : Base
{
...
public Derived(int x) : Base(x)
{
...
}
...
}
Declare a virtual
method
Use the virtual keyword when declaring the method. For example:
class Mammal
{