mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
fix mix of tabs and spaces
This commit is contained in:
@@ -5297,17 +5297,17 @@ Note that because of language rules, the covariant return type cannot be a smart
|
|||||||
public:
|
public:
|
||||||
point(int xx, int yy) : x{xx}, y{yy} { }
|
point(int xx, int yy) : x{xx}, y{yy} { }
|
||||||
int get_x() { return x; }
|
int get_x() { return x; }
|
||||||
void set_x(int xx) { x = xx; }
|
void set_x(int xx) { x = xx; }
|
||||||
int get_y() { return y; }
|
int get_y() { return y; }
|
||||||
void set_y(int yy) { y = yy; }
|
void set_y(int yy) { y = yy; }
|
||||||
// no behavioral member functions
|
// no behavioral member functions
|
||||||
};
|
};
|
||||||
|
|
||||||
Consider making such a class a `struct` -- that is, a behaviorless bunch of variables, all public data and no member functions.
|
Consider making such a class a `struct` -- that is, a behaviorless bunch of variables, all public data and no member functions.
|
||||||
|
|
||||||
struct point {
|
struct point {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
##### Note
|
##### Note
|
||||||
@@ -12819,7 +12819,7 @@ Here is an example of the last option:
|
|||||||
|
|
||||||
class B {
|
class B {
|
||||||
public:
|
public:
|
||||||
B() { /* ... */ f(); /*...*/ } // BAD: see Item 49.1
|
B() { /* ... */ f(); /*...*/ } // BAD: see Item 49.1
|
||||||
|
|
||||||
virtual void f() = 0;
|
virtual void f() = 0;
|
||||||
|
|
||||||
@@ -12830,7 +12830,7 @@ Here is an example of the last option:
|
|||||||
protected:
|
protected:
|
||||||
B() { /* ... */ }
|
B() { /* ... */ }
|
||||||
virtual void PostInitialize() // called right after construction
|
virtual void PostInitialize() // called right after construction
|
||||||
{ /* ... */ f(); /*...*/ } // GOOD: virtual dispatch is safe
|
{ /* ... */ f(); /*...*/ } // GOOD: virtual dispatch is safe
|
||||||
public:
|
public:
|
||||||
virtual void f() = 0;
|
virtual void f() = 0;
|
||||||
|
|
||||||
@@ -12842,9 +12842,9 @@ Here is an example of the last option:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class D : public B { /* "¦ */ }; // some derived class
|
class D : public B { /* "¦ */ }; // some derived class
|
||||||
|
|
||||||
shared_ptr<D> p = D::Create<D>(); // creating a D object
|
shared_ptr<D> p = D::Create<D>(); // creating a D object
|
||||||
|
|
||||||
This design requires the following discipline:
|
This design requires the following discipline:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user