зеркало из
				https://github.com/iharh/notes.git
				synced 2025-11-03 23:26:09 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			20 строки
		
	
	
		
			372 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			20 строки
		
	
	
		
			372 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
class Base
 | 
						|
{
 | 
						|
  typedef void (*FP)();
 | 
						|
  typedef int (*FPGet) (const Base &);
 | 
						|
  typedef void (*FPSet) (Base &, int);
 | 
						|
 | 
						|
  static FP vtbl[totalMethods][totalClasses];
 | 
						|
 | 
						|
  uint8_t tag;
 | 
						|
public:
 | 
						|
  int get() const {
 | 
						|
    return ((FPGet)(vtbl[0][tag]))(*this);
 | 
						|
  }
 | 
						|
  void set(int x) {
 | 
						|
    ((FPSet)vtbl[1][tag])(*this, x);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
// double index is just a single address calculation.
 |