mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			437 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			437 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
==== Source: A ====
 | 
						|
contract C {
 | 
						|
	int private x;
 | 
						|
	constructor (int p) public { x = p; }
 | 
						|
	function getX() public returns (int) { return x; }
 | 
						|
}
 | 
						|
==== Source: B ====
 | 
						|
import "A" as M;
 | 
						|
 | 
						|
contract D is M.C {
 | 
						|
	constructor (int p) M.C(p) public {}
 | 
						|
}
 | 
						|
 | 
						|
contract A {
 | 
						|
	function g(int p) public returns (int) {
 | 
						|
		D d = new D(p);
 | 
						|
		return d.getX();
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
// ----
 | 
						|
// g(int256): -1 -> -1
 | 
						|
// gas legacy: 103494
 | 
						|
// g(int256): 10 -> 10
 | 
						|
// gas legacy: 103122
 |