re-indent

master
neingeist 10 years ago
parent d08cb5c79c
commit 7579fe1f6e

@ -2,12 +2,12 @@
#include <string>
class mybase {
protected:
std::string ids;
protected:
std::string ids;
public:
mybase(std::string ids)
: ids(ids) {}
public:
mybase(std::string ids)
: ids(ids) {}
virtual void foo() {
std::cout << "i'm a mybase! ids: " << ids << std::endl;
@ -15,7 +15,7 @@ class mybase {
};
class myclass : public mybase {
public:
public:
myclass(std::string ids)
: mybase(ids) {}

@ -2,39 +2,39 @@
#include <vector>
class Animal {
public:
Animal() {
std::cout << "constructor" << std::endl;
}
Animal(const Animal& other) {
std::cout << "copy constructor (" << &other << ")" << std::endl;
}
// Note: using *virtual* does the difference here!
virtual void makeSound() const {
std::cout << "<generic animal sound> from " << this << std::endl;
}
Animal& operator= (Animal &a) {
std::cout << "lol, operator= of " << this;
std::cout << "(arg: " << &a << ")" << std::endl;
return *this;
}
public:
Animal() {
std::cout << "constructor" << std::endl;
}
Animal(const Animal& other) {
std::cout << "copy constructor (" << &other << ")" << std::endl;
}
// Note: using *virtual* does the difference here!
virtual void makeSound() const {
std::cout << "<generic animal sound> from " << this << std::endl;
}
Animal& operator= (Animal &a) {
std::cout << "lol, operator= of " << this;
std::cout << "(arg: " << &a << ")" << std::endl;
return *this;
}
};
class Cow : public Animal {
public:
void makeSound() const {
std::cout << "Mooh. from " << this << std::endl;
}
public:
void makeSound() const {
std::cout << "Mooh. from " << this << std::endl;
}
};
class Cat : public Animal {
public:
void makeSound() const {
std::cout << "Meow? from " << this << std::endl;
}
public:
void makeSound() const {
std::cout << "Meow? from " << this << std::endl;
}
};
void call(Animal a) {

@ -3,11 +3,11 @@
/* abstract */
class Animal {
public:
// virtual std::string talk() = 0; /* pure virtual */
virtual std::string talk() { /* or an implementation */
return "<sound>";
}
public:
// virtual std::string talk() = 0; /* pure virtual */
virtual std::string talk() { /* or an implementation */
return "<sound>";
}
};
class Cat : public Animal {

Loading…
Cancel
Save